Skip to content

ALTER MOVE out-of-bounds to another disk #106960

Closed

Description

@PedroTadim

Describe the bug

Easy to reproduce

How to reproduce

With this setup:

<storage_configuration>
    <disks>
        <disk0>
            <type>object_storage</type>
            <object_storage_type>local</object_storage_type>
            <metadata_type>local</metadata_type>
            <path>/var/lib/clickhouse/disk0/</path>
        </disk0>
        <disk1>
            <type>object_storage</type>
            <object_storage_type>local</object_storage_type>
            <metadata_type>plain_rewritable</metadata_type>
            <path>/var/lib/clickhouse/disk1/</path>
        </disk1>
    </disks>
    <policies>
        <policy0>
            <volumes>
                <volume0>
                    <disk>disk1</disk>
                    <disk>disk0</disk>
                </volume0>
            </volumes>
        </policy0>
    </policies>
</storage_configuration>

Run:

CREATE TABLE t0 (c0 Int) ENGINE = MergeTree() ORDER BY tuple() SETTINGS remove_empty_parts = 0, storage_policy = 'policy0';
INSERT INTO TABLE t0 (c0) VALUES (1);
ALTER TABLE t0 DROP PARTITION tuple();
ALTER TABLE t0 MOVE PARTITION tuple() TO DISK 'disk1'; --SEGV

Error message and/or stacktrace

Stack trace:

contrib/llvm-project/libcxx/include/__vector/vector.h:436: libc++ Hardening assertion !empty() failed: front() called on an empty vector
[ip-10-2-3-131] 2026.06.10 12:13:44.516776 [ 1366355 ] <Fatal> BaseDaemon: ########################################
[ip-10-2-3-131] 2026.06.10 12:13:44.516887 [ 1366355 ] <Fatal> BaseDaemon: (version 26.6.1.584 (official build), build id: 64374109E15FA5B7891B33D3EC113B6564A485C2, git hash: f086fa5d0d07573944daa7eb808035c053e87327) (from thread 1367097) (query_id: 7e0c3da2-9536-4d49-9821-abb8d922124d) (query: ALTER TABLE t0 MOVE PARTITION tuple() TO DISK 'disk1';) Received signal Aborted (6)
[ip-10-2-3-131] 2026.06.10 12:13:44.516922 [ 1366355 ] <Fatal> BaseDaemon: Sent by tkill.
[ip-10-2-3-131] 2026.06.10 12:13:44.516968 [ 1366355 ] <Fatal> BaseDaemon: Stack trace: 0x000074e355a9eb2d 0x000074e355a4527e 0x000074e355a288ff 0x00005867220302e5 0x000058670ee6f104 0x000058670ee08652 0x000058670edff3f3 0x000058670edd89fd 0x000058670edcdc36 0x000058670b97174a 0x000058670b9714e2 0x000058670a356b8b 0x000058670a35e28b 0x000058670a3540d9 0x000058670a35b64e 0x000074e355a9caa4 0x000074e355b29c6c
[ip-10-2-3-131] 2026.06.10 12:13:44.517021 [ 1366355 ] <Fatal> BaseDaemon: 3. pthread_kill@@GLIBC_2.34 @ 0x000000000009eb2d
[ip-10-2-3-131] 2026.06.10 12:13:44.517056 [ 1366355 ] <Fatal> BaseDaemon: 4. __GI_raise @ 0x000000000004527e
[ip-10-2-3-131] 2026.06.10 12:13:44.517093 [ 1366355 ] <Fatal> BaseDaemon: 5. __GI_abort @ 0x00000000000288ff
[ip-10-2-3-131] 2026.06.10 12:13:44.525077 [ 1366355 ] <Fatal> BaseDaemon: 6. contrib/llvm-project/libcxx/src/verbose_abort.cpp:62:3: ? @ 0x000000002cae72e5
[ip-10-2-3-131] 2026.06.10 12:13:44.550922 [ 1366355 ] <Fatal> BaseDaemon: 7.0. inlined from contrib/llvm-project/libcxx/include/__vector/vector.h:436: std::vector<DB::StoredObject, std::allocator<DB::StoredObject>>::front[abi:sqe220101]() const
[ip-10-2-3-131] 2026.06.10 12:13:44.550960 [ 1366355 ] <Fatal> BaseDaemon: 7. src/Disks/DiskObjectStorage/MetadataStorages/PlainRewritable/MetadataStorageFromPlainRewritableObjectStorage.cpp:409:5: DB::MetadataStorageFromPlainRewritableObjectStorageTransaction::createMetadataFile(String const&, std::vector<DB::StoredObject, std::allocator<DB::StoredObject>> const&) @ 0x0000000019926104
[ip-10-2-3-131] 2026.06.10 12:13:44.582570 [ 1366355 ] <Fatal> BaseDaemon: 8.0. inlined from src/Disks/DiskObjectStorage/DiskObjectStorageTransaction.cpp:518: operator()
[ip-10-2-3-131] 2026.06.10 12:13:44.582637 [ 1366355 ] <Fatal> BaseDaemon: 8.1. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:90: std::__invoke_result_impl<void, DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>>::type std::__invoke[abi:sqe220101]<DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>>(DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>&&)
[ip-10-2-3-131] 2026.06.10 12:13:44.582665 [ 1366355 ] <Fatal> BaseDaemon: 8.2. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:350: void std::__invoke_void_return_wrapper<void, true>::__call[abi:sqe220101]<DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>>(DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>&&)
[ip-10-2-3-131] 2026.06.10 12:13:44.582696 [ 1366355 ] <Fatal> BaseDaemon: 8.3. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:356: void std::__invoke_r[abi:sqe220101]<void, DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>>(DB::DiskObjectStorageTransaction::copyFileImpl(std::shared_ptr<DB::IMetadataStorage> const&, std::shared_ptr<DB::ClusterConfiguration> const&, std::shared_ptr<DB::ObjectStorageRouter> const&, String const&, String const&, DB::ReadSettings const&, DB::WriteSettings const&)::$_2&, std::shared_ptr<DB::IMetadataTransaction>&&)
[ip-10-2-3-131] 2026.06.10 12:13:44.582713 [ 1366355 ] <Fatal> BaseDaemon: 8. contrib/llvm-project/libcxx/include/__functional/function.h:443:13: ? @ 0x00000000198bf652
[ip-10-2-3-131] 2026.06.10 12:13:44.606388 [ 1366355 ] <Fatal> BaseDaemon: 9.0. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:502: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.606432 [ 1366355 ] <Fatal> BaseDaemon: 9.1. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:754: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.606444 [ 1366355 ] <Fatal> BaseDaemon: 9. src/Disks/DiskObjectStorage/DiskObjectStorageTransaction.cpp:539:12: DB::DiskObjectStorageTransaction::commit() @ 0x00000000198b63f3
[ip-10-2-3-131] 2026.06.10 12:13:44.622359 [ 1366355 ] <Fatal> BaseDaemon: 10. src/Disks/DiskObjectStorage/DiskObjectStorage.cpp:307:26: DB::DiskObjectStorage::copyFile(String const&, DB::IDisk&, String const&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&) @ 0x000000001988f9fd
[ip-10-2-3-131] 2026.06.10 12:13:44.642060 [ 1366355 ] <Fatal> BaseDaemon: 11.0. inlined from src/Disks/IDisk.cpp:158: operator()
[ip-10-2-3-131] 2026.06.10 12:13:44.642101 [ 1366355 ] <Fatal> BaseDaemon: 11.1. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:90: std::__invoke_result_impl<void, DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&>::type std::__invoke[abi:sqe220101]<DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&>(DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.642124 [ 1366355 ] <Fatal> BaseDaemon: 11.2. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:350: void std::__invoke_void_return_wrapper<void, true>::__call[abi:sqe220101]<DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&>(DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.642149 [ 1366355 ] <Fatal> BaseDaemon: 11.3. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:356: void std::__invoke_r[abi:sqe220101]<void, DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&>(DB::asyncCopy(DB::IDisk&, String, DB::IDisk&, String, DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>&, DB::ReadSettings const&, DB::WriteSettings const&, std::function<void ()> const&)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.642191 [ 1366355 ] <Fatal> BaseDaemon: 11. contrib/llvm-project/libcxx/include/__functional/function.h:443:27: ? @ 0x0000000019884c36
[ip-10-2-3-131] 2026.06.10 12:13:44.653750 [ 1366355 ] <Fatal> BaseDaemon: 12.0. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:502: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.653788 [ 1366355 ] <Fatal> BaseDaemon: 12.1. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:754: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.653796 [ 1366355 ] <Fatal> BaseDaemon: 12. src/Common/threadPoolCallbackRunner.h:158:12: void DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>::executeCallback<std::function<void ()>>(std::promise<void>&, std::function<void ()>&&, std::shared_ptr<DB::ThreadGroup>, DB::ThreadName) @ 0x000000001642874a
[ip-10-2-3-131] 2026.06.10 12:13:44.662516 [ 1366355 ] <Fatal> BaseDaemon: 13. src/Common/threadPoolCallbackRunner.h:222:13: DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>::enqueueAndGiveOwnership(std::function<void ()>&&, Priority, std::optional<unsigned long>)::'lambda'()::operator()() @ 0x00000000164284e2
[ip-10-2-3-131] 2026.06.10 12:13:44.672374 [ 1366355 ] <Fatal> BaseDaemon: 14.0. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:502: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.672393 [ 1366355 ] <Fatal> BaseDaemon: 14.1. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:754: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.672407 [ 1366355 ] <Fatal> BaseDaemon: 14. src/Common/ThreadPool.cpp:802:12: ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::worker() @ 0x0000000014e0db8b
[ip-10-2-3-131] 2026.06.10 12:13:44.689449 [ 1366355 ] <Fatal> BaseDaemon: 15.0. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:502: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.689476 [ 1366355 ] <Fatal> BaseDaemon: 15.1. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:754: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.689640 [ 1366355 ] <Fatal> BaseDaemon: 15.2. inlined from src/Common/ThreadPool.cpp:961: operator()
[ip-10-2-3-131] 2026.06.10 12:13:44.689669 [ 1366355 ] <Fatal> BaseDaemon: 15.3. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:90: std::__invoke_result_impl<void, startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&>::type std::__invoke[abi:sqe220101]<startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&>(startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.689692 [ 1366355 ] <Fatal> BaseDaemon: 15.4. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:350: void std::__invoke_void_return_wrapper<void, true>::__call[abi:sqe220101]<startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&>(startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.689714 [ 1366355 ] <Fatal> BaseDaemon: 15.5. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:356: void std::__invoke_r[abi:sqe220101]<void, startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&>(startThreadFromGlobalPool(std::shared_ptr<ThreadFromGlobalPoolState>, std::function<void ()>, unsigned long, unsigned long, bool, bool)::$_0&)
[ip-10-2-3-131] 2026.06.10 12:13:44.689737 [ 1366355 ] <Fatal> BaseDaemon: 15. contrib/llvm-project/libcxx/include/__functional/function.h:443:12: ? @ 0x0000000014e1528b
[ip-10-2-3-131] 2026.06.10 12:13:44.698499 [ 1366355 ] <Fatal> BaseDaemon: 16.0. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:502: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.698520 [ 1366355 ] <Fatal> BaseDaemon: 16.1. inlined from contrib/llvm-project/libcxx/include/__functional/function.h:754: ?
[ip-10-2-3-131] 2026.06.10 12:13:44.698533 [ 1366355 ] <Fatal> BaseDaemon: 16. src/Common/ThreadPool.cpp:812:12: ThreadPoolImpl<std::thread>::ThreadFromThreadPool::worker() @ 0x0000000014e0b0d9
[ip-10-2-3-131] 2026.06.10 12:13:44.715371 [ 1366355 ] <Fatal> BaseDaemon: 17.0. inlined from contrib/llvm-project/libcxx/include/__type_traits/invoke.h:0: std::__invoke_result_impl<void, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>::type std::__invoke[abi:sqe220101]<void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>(void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*&&)
[ip-10-2-3-131] 2026.06.10 12:13:44.715407 [ 1366355 ] <Fatal> BaseDaemon: 17.1. inlined from contrib/llvm-project/libcxx/include/__thread/thread.h:161: void std::__thread_execute[abi:sqe220101]<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*, 0ul, 1ul>(std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>&, std::__integer_sequence<unsigned long, 0ul, 1ul>)
[ip-10-2-3-131] 2026.06.10 12:13:44.715420 [ 1366355 ] <Fatal> BaseDaemon: 17. contrib/llvm-project/libcxx/include/__thread/thread.h:169: void* std::__thread_proxy[abi:sqe220101]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x0000000014e1264e
[ip-10-2-3-131] 2026.06.10 12:13:44.715450 [ 1366355 ] <Fatal> BaseDaemon: 18. start_thread @ 0x000000000009caa4
[ip-10-2-3-131] 2026.06.10 12:13:44.715781 [ 1366355 ] <Fatal> BaseDaemon: 19. __GI___clone3 @ 0x0000000000129c6c
[ip-10-2-3-131] 2026.06.10 12:13:44.952562 [ 1366355 ] <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: 06057E431AD2E1F5F910739C0D173E36)
[ip-10-2-3-131] 2026.06.10 12:13:44.953195 [ 1366355 ] <Fatal> BaseDaemon: ClickHouse version 26.6.1.584 is old and should be upgraded to the latest version.
[ip-10-2-3-131] 2026.06.10 12:13:44.953374 [ 1366355 ] <Fatal> BaseDaemon: Changed settings: s3_truncate_on_insert = true, azure_truncate_on_insert = true, allow_suspicious_low_cardinality_types = true, allow_suspicious_fixed_string_types = true, allow_suspicious_indices = true, allow_suspicious_ttl_expressions = true, allow_suspicious_variant_types = true, allow_suspicious_primary_key = true, allow_suspicious_types_in_group_by = true, allow_suspicious_types_in_order_by = true, enable_positional_arguments = true, allow_nonconst_timezone_arguments = true, enable_time_time64_type = true, allow_nondeterministic_optimize_skip_unused_shards = true, table_function_remote_max_addresses = 200, insert_allow_materialized_columns = true, allow_distributed_ddl = true, allow_suspicious_codecs = true, max_execution_time = 60., allow_custom_error_code_in_throwif = true, allow_ddl = true, allow_introspection_functions = true, allow_drop_detached = true, enable_lightweight_delete = true, allow_materialized_view_with_bad_select = true, allow_settings_after_format_in_insert = true, allow_nondeterministic_mutations = true, allow_non_metadata_alters = true, enable_materialized_cte = true, enable_lightweight_update = true, query_cache_nondeterministic_function_handling = 'ignore', query_cache_system_table_handling = 'ignore', allow_experimental_kafka_offsets_storage_in_keeper = true, engine_file_truncate_on_insert = true, database_replicated_allow_replicated_engine_arguments = 1, allow_experimental_correlated_subqueries = true, keeper_max_retries = 15, enable_order_by_all = true, allow_dynamic_type_in_join_keys = true, allow_create_index_without_type = true, allow_named_collection_override_by_default = true, allow_experimental_geo_types_in_iceberg = true, allow_experimental_delta_lake_writes = true, allow_experimental_parallel_reading_from_replicas = 0, parallel_replicas_for_non_replicated_merge_tree = true, parallel_replicas_allow_materialized_views = true, allow_experimental_database_iceberg = true, allow_experimental_database_unity_catalog = true, allow_experimental_database_glue_catalog = true, allow_experimental_analyzer = true, allow_experimental_materialized_postgresql_table = true, allow_experimental_funnel_functions = true, allow_experimental_nlp_functions = true, allow_experimental_hash_functions = true, allow_experimental_time_series_table = true, allow_experimental_unique_key = true, allow_experimental_codecs = true, allow_experimental_join_right_table_sorting = true, allow_experimental_json_lazy_type_hints = true, enable_streaming_queries = true, enable_full_text_index = true, allow_experimental_window_view = true, allow_experimental_database_materialized_postgresql = true, allow_experimental_nullable_tuple_type = true, allow_nullable_tuple_in_extracted_subcolumns = true, allow_experimental_query_deduplication = true, allow_experimental_database_hms_catalog = true, allow_experimental_kusto_dialect = true, allow_experimental_prql_dialect = true, allow_experimental_polyglot_dialect = true, allow_experimental_delta_kernel_rs = true, allow_insert_into_iceberg = true, allow_experimental_cleanup_old_data_files_compaction = true, allow_experimental_iceberg_compaction = true, allow_iceberg_remove_orphan_files = true, allow_experimental_expire_snapshots = true, allow_experimental_ytsaurus_table_engine = true, allow_experimental_ytsaurus_table_function = true, allow_experimental_ytsaurus_dictionary_source = true, allow_experimental_time_series_aggregate_functions = true, allow_experimental_paimon_storage_engine = true, allow_experimental_object_storage_queue_hive_partitioning = true, allow_experimental_database_paimon_rest_catalog = true, allow_experimental_ai_functions = true, allow_experimental_alias_table_engine = true, allow_not_comparable_types_in_order_by = true, allow_not_comparable_types_in_comparison_functions = true, enable_zstd_qat_codec = true, enable_deflate_qpl_codec = true, type_json_skip_duplicated_paths = true, input_format_parquet_allow_geoparquet_parser = true

Version info

Activity

  1. added
    bug
    crash
    fuzz
    on Jun 10, 2026
  2. PedroTadim commented on Jun 10, 2026

    @PedroTadim
    MemberAuthor

    @groeneai you know what to do!

  3. PedroTadim commented on Jun 10, 2026

    @PedroTadim
    MemberAuthor

    @clickgapai I think this is a regression introduced a few releases back, can you bisect?

  4. groeneai commented on Jun 10, 2026

    @groeneai
    Collaborator

    @PedroTadim reproduced and fixed: #107040.

    Root cause: an empty part (0 rows, kept by remove_empty_parts = 0 after DROP PARTITION) holds 0-byte files. A local-metadata disk stores a 0-byte file with zero stored objects, so the cross-disk copy (DiskObjectStorageTransaction::copyFileImpl) calls createMetadataFile(to_file_path, {}) with an empty objects list. The plain_rewritable implementation did objects.front() unconditionally and aborted on the empty vector (front() called on an empty vector at MetadataStorageFromPlainRewritableObjectStorage.cpp:409). The local and non-rewritable plain metadata storages already accept an empty list, so the fix makes plain_rewritable do the same: record a 0-byte file.

    On the bisect: this regressed in 25.12, when the plain_rewritable metadata storage was split off from the unified plain implementation (the createMetadataFile -> objects.front() path arrived with commits 3da089d / a18a4fd, first stable tag v25.12.1.649). Before that the unified MetadataStorageFromPlainObjectStorage was used. So @clickgapai's bisect should land in the 25.12 window.

    Verified both directions on a debug build: unfixed -> SIGABRT (exact backtrace match), fixed -> the move succeeds and the empty part stays fully functional (count/insert/select/optimize/drop). Added stateless test 04327_move_empty_part_to_plain_rewritable.

  5. clickgapai commented on Jun 12, 2026

    @clickgapai
    Contributor

    Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

    TL;DR

    ALTER MOVE out-of-bounds to another disk

    ClickGap verified: reproduced it with the script below on master; tested 1 version(s) — 1 affected, 0 clean (see Affects).

    Reproduction

    Shell reproducer — run against a local ClickHouse build (bash <script> <clickhouse-binary>); requires the referenced test fixtures from the repo.

    #!/bin/bash
    # Repro for issue #106960 — ALTER MOVE PARTITION of an empty part onto a
    # plain_rewritable disk dereferences an empty StoredObjects vector and aborts.
    #   bash repro.sh <clickhouse_binary>
    #   exit 1   = bug reproduces (crash / hardening abort)
    #   exit 0   = clean (queries ran, no crash)
    #   exit 125 = inconclusive (feature/config absent or query errored)
    #   exit 124 = timed out
    set -uo pipefail
    
    BIN="$1"
    WORK="$(mktemp -d /tmp/repro_106960.XXXXXX)"
    trap 'rm -rf "$WORK"' EXIT
    mkdir -p "$WORK/disk0" "$WORK/disk1" "$WORK/ch"
    
    CFG="$WORK/config.xml"
    cat > "$CFG" <<XML
    <clickhouse>
        <storage_configuration>
            <disks>
                <disk0>
                    <type>object_storage</type>
                    <object_storage_type>local</object_storage_type>
                    <metadata_type>local</metadata_type>
                    <path>$WORK/disk0/</path>
                </disk0>
                <disk1>
                    <type>object_storage</type>
                    <object_storage_type>local</object_storage_type>
                    <metadata_type>plain_rewritable</metadata_type>
                    <path>$WORK/disk1/</path>
                </disk1>
            </disks>
            <policies>
                <policy0>
                    <volumes>
                        <volume0>
                            <disk>disk1</disk>
                            <disk>disk0</disk>
                        </volume0>
                    </volumes>
                </policy0>
            </policies>
        </storage_configuration>
    </clickhouse>
    XML
    
    # -k/-s KILL: the hardening abort's fatal handler can hang while collecting a
    # backtrace; SIGTERM is ignored mid-crash, so force-kill and read the captured
    # stderr (the assertion line is flushed at abort time, before the hang).
    OUT=$(timeout -k 5 -s KILL 30 "$BIN" local \
            --config-file="$CFG" --path="$WORK/ch/" \
            ${CLICKGAP_REPRO_SETTINGS:+--$CLICKGAP_REPRO_SETTINGS} \
            --multiquery 2>&1 <<'SQL'
    CREATE TABLE t0 (c0 Int) ENGINE = MergeTree() ORDER BY tuple() SETTINGS remove_empty_parts = 0, storage_policy = 'policy0';
    INSERT INTO TABLE t0 (c0) VALUES (1);
    ALTER TABLE t0 DROP PARTITION tuple();
    ALTER TABLE t0 MOVE PARTITION tuple() TO DISK 'disk1';
    SQL
    )
    RC=$?
    
    # 1) Crash signature → the bug (caught regardless of how the process terminated;
    #    the abort/SIGKILL may yield rc 134/137, but the assertion line is in stderr)
    if echo "$OUT" | grep -qiE "front\(\) called on an empty vector|Hardening assertion|Received signal Aborted|libc\+\+ Hardening|Segmentation fault|<Fatal>"; then
        echo "OBSERVED: crash/abort signature present (rc=$RC)"
        echo "$OUT" | tail -6
        exit 1
    fi
    # 2) abort (128+6) / segv (128+11) exit codes with no captured line → still bug
    if [ "$RC" = "134" ] || [ "$RC" = "139" ]; then
        echo "OBSERVED: process aborted (rc=$RC)"
        echo "$OUT" | tail -6
        exit 1
    fi
    # 3) timed out / force-killed without a crash line → flaky, not clean
    if [ "$RC" = "124" ] || [ "$RC" = "137" ]; then
        echo "OBSERVED: hung / force-killed without crash signature (rc=$RC)"
        echo "$OUT" | tail -6
        exit 124
    fi
    # 4) any query/config error → inconclusive (feature/syntax/disk-config absent on
    #    this build); an ERROR is NOT a clean baseline for the bisect.
    if echo "$OUT" | grep -qiE "Code: [0-9]+|DB::Exception|NOT_IMPLEMENTED|UNKNOWN_[A-Z]+|Unknown setting|Unknown storage policy|Cannot parse|Unknown element|Bad cast"; then
        echo "OBSERVED: query/config error — feature/config absent on this build (rc=$RC)"
        echo "$OUT" | tail -6
        exit 125
    fi
    # 5) clean: queries ran, no crash
    echo "OBSERVED: queries completed without crash (rc=$RC)"
    echo "$OUT" | tail -6
    exit 0

    Bisect

    • Bisected on master in several steps (confidence: MEDIUM); a single introducing PR could not be pinned (culprit confirmation was inconclusive).
    • A source-build bisect over the range will be attempted to pin the exact commit.

    Affects

    • Tested on master @ commit e730b593b836 (aarch64)
    • Reproduces on: master
    • Could not test (binary unavailable): 26.5, 26.4, 26.3, 25.8

    Suggested next step

    Manual triage of the comp-object-storage-disks path is needed. The reproducer above should be a fast first check.

    Component: comp-object-storage-disks
    Severity: P2


    ClickGap · Finding: h_issue_106960

    Triage metadata

    • Primary component: comp-object-storage-disks
    • Secondary components: comp-multidisk
    • Component owners (comp-object-storage-disks): @Michicosun @kssenii
  6. added
    comp-object-storage-disks
    on Jun 25, 2026
  7. clickhouse-gh commented on Jun 25, 2026

    @clickhouse-gh
    Contributor

    Crash classifier applied:

    • Label: comp-object-storage-disks
    • Assignee: @alesapin
  8. added a commit that references this issue on Jul 14, 2026
    11d23a1
  9. groeneai commented on Jul 27, 2026

    @groeneai
    Collaborator

    The fix for this issue (#107040) is incomplete on 26.3, 26.4 and 26.5. The reported crash still reproduces there with the configuration and query in the report above. master, 26.6 and 26.7 are correct.

    The backport put the guard on a path this repro does not take

    #107040 added the empty-blob guard to DiskObjectStorageTransaction::copyFile. On master that body is the shared helper copyFileImpl, which both DiskObjectStorageTransaction::copyFile and MultipleDisksObjectStorageTransaction::copyFile delegate to, so one hunk covers both overloads. On 26.3/26.4/26.5 there is no copyFileImpl: the two overloads are separate function bodies, and the backports (#110818, #110819, #110820) applied the hunk to only the first one.

    for b in 26.3 26.4 26.5 26.6 master; do
      printf '%s ' "$b"
      git show origin/$b:src/Disks/DiskObjectStorage/DiskObjectStorageTransaction.cpp \
        | sed -n '/^void MultipleDisksObjectStorageTransaction::copyFile/,/^}/p' \
        | grep -c 'blobs_to_create.empty()\|copyFileImpl'
    done
    # 26.3 0   26.4 0   26.5 0   26.6 1   master 1
    

    ALTER TABLE t0 MOVE PARTITION tuple() TO DISK 'disk1' goes through the unguarded overload, which is visible in the stack trace in the report: frame 11 is IDisk.cpp:158 (asyncCopy's per-file from_disk.copyFile), and frame 10 is DiskObjectStorage.cpp:307, which is transaction->commit() inside the if (getDataSourceDescription() == to_disk.getDataSourceDescription()) branch, i.e. a MultipleDisksObjectStorageTransaction. The two disks in the report take that branch because DataSourceDescription::operator== (src/Disks/DiskType.cpp:33-36) compares {type, object_storage_type, description, is_encrypted, zookeeper_name} and excludes metadata_type; disk0 and disk1 are both object_storage/local with the same LocalObjectStorage description, differing only in metadata_type. So blobs_to_create is empty for the 0-byte files of the empty part, the unguarded tail calls createMetadataFile(to_file_path, {}), and MetadataStorageFromPlainRewritableObjectStorageTransaction::createMetadataFile does objects.front() on the empty vector.

    It is also breaking ReleaseBranchCI

    The regression test DiskObjectStorageTest.CopyEmptyFileToPlainRewritable was backported and is doing its job: it aborts the unit_tests_dbms binary with the same assertion, so no gtest.json is written and the job reports the gtest filter string instead of the test:

    [ RUN      ] DiskObjectStorageTest.CopyEmptyFileToPlainRewritable
    contrib/llvm-project/libcxx/include/__vector/vector.h:436: libc++ Hardening assertion !empty() failed: front() called on an empty vector
    ERROR: command failed after 1/1 attempt(s), exit code: -6
    ERROR: No test result file [.../ci/tmp/gtest.json]
    

    Because the binary aborts mid-suite, every unit test ordered after it is skipped on those branches.

    branch test present guard in cross-disk overload unit-test jobs
    master / 26.7 / 26.6 yes yes green
    26.5 yes no red since 2026-07-17 14:44 UTC, 26 hits x 3 sanitizer jobs
    26.4 yes no red (reported as check_status=error), last 2026-07-25
    26.3 yes no no unit-test job in the CIDB window, but the code state is identical

    Onset matches the backport merges (2026-07-17 13:00-14:11 UTC) to the minute. Latest 26.5 report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=26.5&sha=e6337d57cd0a2f12648c533345e77ada85ff8556&name_0=ReleaseBranchCI&name_1=Unit%20tests%20%28asan_ubsan%29 (identical assertion in the msan and tsan logs).

    Suggested fix

    Copy the same six lines the backport already applied to the sibling overload into MultipleDisksObjectStorageTransaction::copyFile, immediately before the trailing operations_to_execute.push_back, on each of 26.3, 26.4 and 26.5:

        if (blobs_to_create.empty() && !metadata_storage->supportsEmptyFilesWithoutBlobs())
        {
            writeFile(to_file_path, 0, WriteMode::Rewrite, write_settings)->finalize();
            return;
        }

    The existing backported test needs no change: it fails today and passes once the guard is present. Backporting the copyFileImpl refactor instead would keep the branches structurally identical to master, but it drags a refactor of the copy path (including master's parallel copy dispatch) onto stable branches, so the six-line duplicate looks like the better trade for a bug-fix-only branch. Reverting the test would turn CI green while leaving the crash in three shipping releases, so that does not seem like an option.

    I cannot open these PRs myself, since I do not author release-branch changes, and there is nothing left to fix on master, so the automated backport flow has no source commit to replay. This needs a hand-adapted commit on each of the three branches. @alesapin, this is assigned to you by the crash classifier above.

  10. PedroTadim commented on Jul 27, 2026

    @PedroTadim
    MemberAuthor

    @groeneai can you create the 3 PR fixes for 26.3, 26.4 and 26.5 and I review them?

  11. groeneai commented on Jul 27, 2026

    @groeneai
    Collaborator

    Acknowledged. I will open three release-branch PRs (targeting 26.3, 26.4 and 26.5) that add the empty-blob guard to the separate MultipleDisksObjectStorageTransaction::copyFile body on those branches, verified against the config and ALTER TABLE t0 MOVE PARTITION tuple() TO DISK 'disk1' from the report (abort before, clean after), and I will request your review on each.

    One note on shape, since it is unusual: master, 26.6 and 26.7 need no change (both overloads there delegate to the shared DiskObjectStorageTransaction::copyFileImpl, which already carries the guard), so there is no master counterpart to backport from and these have to be release-branch-only PRs. I will keep each one to the same 6-line guard that #110818/#110819/#110820 applied to the other overload, so the two overloads on each branch end up consistent.

  12. added a commit that references this issue on Sep 11, 2026
    aded734
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcomp-object-storage-diskscrashfuzz

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions