Skip to content

Antalya 26.6: Partition export + cluster functions - #2146

Open
zvonand wants to merge 34 commits into
antalya-26.6from
feature/antalya-26.6/auto-grp-pr-1718
Open

Antalya 26.6: Partition export + cluster functions#2146
zvonand wants to merge 34 commits into
antalya-26.6from
feature/antalya-26.6/auto-grp-pr-1718

Conversation

@zvonand

@zvonand zvonand commented Aug 3, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Add support for exporting MergeTree parts and partitions to object storage, including experimental exports to Apache Iceberg, with a command to schedule exports for all partitions at once, automatic type casting as in INSERT ... SELECT, retries with backoff for transient failures, and a persistent history of export tasks in system.replicated_partition_exports. Add alternative syntax for cluster table functions with distributed execution of JOINs on swarm nodes, and speed up object storage queries through caching of S3 ListObjects calls and pre-aggregation on remote nodes.
Add support for exporting MergeTree parts and partitions to object storage, including experimental exports to Apache Iceberg, with a command to schedule exports for all partitions at once, automatic type casting as in INSERT ... SELECT, retries with backoff for transient failures, and a persistent history of export tasks in system.replicated_partition_exports. Add alternative syntax for cluster table functions with distributed execution of JOINs on swarm nodes, and speed up object storage queries through caching of S3 ListObjects calls and pre-aggregation on remote nodes (#1718 by @zvonand, #1646 by @ianton-ru, #1640 by @ianton-ru, #1744 by @zvonand, #1713 by @arthurpassos, #1783 by @ianton-ru, #1741 by @arthurpassos, #1728 by @arthurpassos, #1730 by @arthurpassos, #1813 by @arthurpassos, #1836 by @arthurpassos, #1847 by @arthurpassos, #1782 by @ianton-ru, #1845 by @ianton-ru, #1856 by @ianton-ru, #1863 by @ianton-ru, #1872 by @ianton-ru, #1917 by @arthurpassos, #1779 by @arthurpassos, #1912 by @arthurpassos, #1990 by @arthurpassos, #2004 by @arthurpassos, #1984 by @arthurpassos).

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All with Aarch64
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

Combined port of 23 PR(s) (group auto-grp-pr-1718). Cherry-picked from #1718, #1646, #1640, #1744, #1713, #1783, #1741, #1728, #1730, #1813, #1836, #1847, #1782, #1845, #1856, #1863, #1872, #1917, #1779, #1912, #1990, #2004, #1984.

zvonand added 4 commits August 3, 2026 13:18
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1718 from Altinity/feature/antalya-26.3/apassos-3

Antalya 26.3: apassos-3: combined port of 12 PRs
# Conflicts:
#	ci/jobs/scripts/integration_tests_configs.py
#	contrib/openssl
#	src/Common/ErrorCodes.cpp
#	src/Common/FailPoint.cpp
#	src/Common/ProfileEvents.cpp
#	src/Common/setThreadName.h
#	src/Core/Settings.cpp
#	src/Core/SettingsEnums.cpp
#	src/Core/SettingsEnums.h
#	src/Disks/DiskObjectStorage/ObjectStorages/IObjectStorage.h
#	src/Functions/generateSnowflakeID.cpp
#	src/Interpreters/DDLWorker.cpp
#	src/Parsers/ASTAlterQuery.cpp
#	src/Parsers/ASTSystemQuery.cpp
#	src/Parsers/ParserAlterQuery.cpp
#	src/Storages/IPartitionStrategy.cpp
#	src/Storages/IPartitionStrategy.h
#	src/Storages/MergeTree/IMergeTreeDataPart.cpp
#	src/Storages/MergeTree/MergeTreeData.cpp
#	src/Storages/MergeTree/MergeTreeData.h
#	src/Storages/ObjectStorage/DataLakes/IDataLakeMetadata.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/MultipleFileWriter.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/MultipleFileWriter.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
#	src/Storages/ObjectStorage/StorageObjectStorage.cpp
#	src/Storages/ObjectStorage/StorageObjectStorage.h
#	src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp
#	src/Storages/ObjectStorage/StorageObjectStorageConfiguration.h
#	src/Storages/ObjectStorage/StorageObjectStorageSink.h
#	src/Storages/ObjectStorage/StorageObjectStorageSource.cpp
#	src/Storages/ObjectStorage/StorageObjectStorageSource.h
#	src/Storages/StorageMergeTree.cpp
#	src/Storages/StorageReplicatedMergeTree.cpp
#	src/Storages/StorageReplicatedMergeTree.h
#	src/Storages/System/StorageSystemMerges.cpp
#	src/Storages/System/attachSystemTables.cpp
#	tests/queries/0_stateless/03413_experimental_settings_cannot_be_enabled_by_default.sql
#	tests/queries/0_stateless/03745_system_background_schedule_pool.reference
Kept antalya-26.6 side for everything outside the source PR's scope and
added the PR's new surfaces (export part/partition, list-objects cache,
Iceberg export) on top.

Adapted: PENDING_MUTATIONS_NOT_ALLOWED moved to error code 1009 (1005-1008 are taken on antalya-26.6) and END bumped accordingly
Adapted: MergeTreeData::writePartLog keeps antalya-26.6's projections_duration_ms parameter and appends the PR's exports_entry; ExportPartTask call sites pass the extra argument
Adapted: generateManifestFile keeps antalya-26.6's user_defined_sequence_number / per-file row+byte counts and appends the PR's per_file_stats; the export-commit call site boxes data file paths into Iceberg::IcebergPathFromMetadata
Adapted: MultipleFileWriter::getDataFileEntries is implemented on antalya-26.6's existing per-file bookkeeping (data_file_names / data_file_row_counts / data_file_byte_counts / completed_file_stats) instead of the PR's duplicate vectors
Source-PR: #1718 (#1718)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1646 from Altinity/frontport/antalya-26.3/fix_remote_calls

26.3 Antalya port - fixes for s3Cluster distributed calls
# Conflicts:
#	src/Planner/Planner.cpp
#	src/Processors/QueryPlan/ObjectFilterStep.cpp
#	src/Processors/QueryPlan/ObjectFilterStep.h
#	src/Processors/QueryPlan/QueryPlanStepRegistry.cpp
#	src/Processors/QueryPlan/ReadFromRemote.cpp
#	src/QueryPipeline/RemoteQueryExecutor.h
#	src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp
#	tests/integration/test_database_iceberg/test.py
#	tests/integration/test_s3_cluster/test.py
Kept antalya-26.6's already-present, evolved copies of the pieces this
frontport re-adds (ObjectFilterStep, its registry entry, the
snapshot-based virtuals list in StorageObjectStorageCluster and
test_hive_partitioning in test_s3_cluster), and applied the source PR's
genuinely new additions on top: the analyzer-side addObjectFilterStep in
Planner.cpp, RemoteQueryExecutor::setRemoteFunction/setShardCount plus
their ReadFromRemote call sites, and the new integration tests
(test_remote_hedged, test_remote_no_hedged, test_joins,
_test_cluster_joins).

Context-only lines from the 26.3 source that antalya-26.6 no longer has
(duplicated_part_uuids, threading/time/HeaderParseError and FloatType
imports) were not re-introduced.

SettingsChangesHistory: uncommented the existing
object_storage_cluster_join_mode row in place and dropped the
cherry-pick's duplicate (which had landed inside an unrelated version
block).

Source-PR: #1646 (#1646)
@zvonand zvonand added ai-needs-attention Releasy stopped on a conflict it could not resolve — needs human review releasy Created/managed by RelEasy antalya-26.6 labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Workflow [PR], commit [f13ad1d]

@zvonand zvonand added the forwardport This is a frontport of code that existed in previous Antalya versions label Aug 4, 2026
zvonand added 21 commits August 5, 2026 17:00
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1640 from Altinity/frontport/antalya-26.3/alternative_syntax

26.3 Antalya port - Alternative syntax for cluster functions
# Conflicts:
#	docs/en/sql-reference/table-functions/iceberg.md
#	src/Analyzer/FunctionNode.h
#	src/Common/ErrorCodes.cpp
#	src/Core/Settings.cpp
#	src/Databases/DataLake/DatabaseDataLake.cpp
#	src/Databases/DataLake/DatabaseDataLakeSettings.cpp
#	src/Databases/DataLake/GlueCatalog.cpp
#	src/Databases/DataLake/ICatalog.cpp
#	src/Databases/DataLake/RestCatalog.cpp
#	src/Databases/DataLake/UnityCatalog.cpp
#	src/Disks/DiskObjectStorage/ObjectStorages/S3/S3ObjectStorage.cpp
#	src/IO/S3/URI.cpp
#	src/IO/S3/URI.h
#	src/IO/S3/getObjectInfo.cpp
#	src/Interpreters/IcebergMetadataLog.cpp
#	src/Parsers/FunctionSecretArgumentsFinder.h
#	src/Server/TCPHandler.cpp
#	src/Storages/IStorageCluster.h
#	src/Storages/ObjectStorage/DataLakes/DataLakeConfiguration.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/PersistentTableComponents.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/SchemaProcessor.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/SchemaProcessor.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
#	src/Storages/ObjectStorage/S3/Configuration.cpp
#	src/Storages/ObjectStorage/StorageObjectStorage.cpp
#	src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp
#	src/Storages/ObjectStorage/StorageObjectStorageConfiguration.h
#	src/Storages/ObjectStorage/StorageObjectStorageSource.cpp
#	src/Storages/ObjectStorage/registerStorageObjectStorage.cpp
#	src/Storages/System/StorageSystemTables.cpp
#	src/TableFunctions/TableFunctionObjectStorage.cpp
#	tests/integration/compose/docker_compose_iceberg_rest_catalog.yml
#	tests/integration/helpers/iceberg_utils.py
#	tests/integration/test_database_delta/test.py
#	tests/integration/test_database_glue/test.py
#	tests/integration/test_database_iceberg/test.py
#	tests/integration/test_mask_sensitive_info/test.py
#	tests/integration/test_s3_cluster/test.py
Removed the conflict markers left by the cherry-pick and kept the source PR's
changes, translated to the shapes antalya-26.6 already has (private
configuration members behind getters, renamed assertInitializedDL, ContextPtr
threaded through IcebergSchemaProcessor, IcebergPathResolver, table UUIDs in
DataLake StorageIDs).

Source-PR: #1640 (#1640)
Antalya 26.3: Fix export task not being killed during s3 outage

Source-PR: #1744 (#1744)
…n_task

Remove lock inside the task export partition

Source-PR: #1713 (#1713)
…_ai_issues

Fix incorrect interaction between object_storage_remote_initiator and object_storage_cluster.

Source-PR: #1783 (#1783)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1741 from Altinity/export_partition_all

Export partition all
# Conflicts:
#	src/Common/ErrorCodes.cpp
#	src/Core/Settings.h
Renumbered the two new error codes (EXPORT_PARTITION_ALREADY_EXPORTED,
PARTITION_EXPORT_FAILED) to the next free values on antalya-26.6, which
already occupies 1005-1009, and bumped END accordingly.

Adapted: error code numbering — antalya-26.6 already uses 1005..1009 (STALE_VERSION..PENDING_MUTATIONS_NOT_ALLOWED), so the PR's 1006/1007 became 1010/1011 and END 1007 became 1011
Source-PR: #1741 (#1741)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1728 from Altinity/export_part_respect_background_memory_limit

Make export part and partition respect background tasks memory limit
# Conflicts:
#	src/Storages/MergeTree/MergeTreeData.cpp
Kept ours' include layout; the only source-PR include addition (Common/MemoryTracker.h) was placed into the relocated <Common/...> include block on antalya-26.6.

Source-PR: #1728 (#1728)
…ptions_observability

improve observability over exceptions

Source-PR: #1730 (#1730)
dont commit while holding the lock on cleanup thread

Source-PR: #1813 (#1813)
…tting_madness

Do not require iceberg insert settings on replicas

Source-PR: #1836 (#1836)
Export partition - Introduce commit lock

Source-PR: #1847 (#1847)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1782 from Altinity/frontport/antalya-26.3/json_part2

Antalya 26.3: Cluster Joins part 2 - global mode
# Conflicts:
#	src/Storages/buildQueryTreeForShard.cpp
#	src/Storages/buildQueryTreeForShard.h
#	tests/integration/test_database_iceberg/test.py
#	tests/integration/test_s3_cluster/test.py
Kept antalya-26.6 additions outside the PR scope (transfer_overflow_mode setting
declaration, forward-declared Block for buildShardCollapseFanOut, per-worker
generated-data cleanup in test_s3_cluster, disabled _test_cluster_joins in
test_database_iceberg) and applied the PR's changes on top; dropped the
unchanged test_hive_partitioning context block the merge commit carried into
the conflict region.

Source-PR: #1782 (#1782)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1845 from Altinity/feature/antalya-26.3/no_useless_describe

Do not make 'describe table' query when schema is known
# Conflicts:
#	src/TableFunctions/TableFunctionRemote.cpp
…emote_initiator_after_non_remote

Fix test_remote_initiator_after_non_remote

Source-PR: #1856 (#1856)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1863 from Altinity/bugfix/antalya-26.3/1855_s3cluster_hive

Fix cluster functions with hive partitioning
# Conflicts:
#	src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp
#	src/Storages/StorageFileCluster.cpp
#	src/Storages/StorageURLCluster.cpp
#	tests/integration/test_file_cluster/test.py
Kept antalya-26.6's metadata-snapshot based virtuals plumbing and applied
the PR's switch to the filtered hive partition column list.

Adapted: IStorageCluster::getHivePartitionColumnsWithoutVirtuals now takes the
metadata snapshot, because IStorage::getVirtualsList() no longer exists on
antalya-26.6 (virtuals live in StorageInMemoryMetadata::virtuals and are read
via metadata->virtuals.getSampleBlock(VirtualsKind::All,
VirtualsMaterializationPlace::Reader).getNamesAndTypesList()).
Adapted: StorageFileCluster sets virtuals through storage_metadata.setVirtuals()
instead of the removed IStorage::setVirtuals(), keeping the PR's new
sample_path / PartitionStrategyFactory::StrategyType::NONE arguments.

Source-PR: #1863 (#1863)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1872 from Altinity/bugfix/antalya-26.3/fix_aggregation_with_remote_initiator

Fix aggregation flow with remote initiator
# Conflicts:
#	src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp
zvonand and others added 9 commits August 5, 2026 18:57
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1917 from Altinity/do_not_evict_entries_from_replicated_partition_exports_table

Turn system.replicated_partition_exports table into a history table by removing the TTL
# Conflicts:
#	antalya/docs/design/alter-table-export-part-partition.md
#	src/Core/Settings.cpp
src/Core/Settings.cpp:
- Removed the DECLARE of export_merge_tree_partition_manifest_ttl (source PR)
  while keeping antalya-26.6's export_merge_tree_partition_task_timeout_seconds
  default of 3600 (the 86400 on "theirs" is unrelated base-branch context).
- Added the MAKE_OBSOLETE row for export_merge_tree_partition_manifest_ttl from
  the source PR, keeping the pre-existing allow_experimental_query_deduplication
  row that "ours" already had in that append-only list.

antalya/docs/design/alter-table-export-part-partition.md does not exist on
antalya-26.6 (introduced by the separate design-doc PR #1673, not ported);
the cherry-pick recreated the whole 752-line file, of which only ~15 lines
belong to #1917. Kept "ours" (file absent) instead of importing another PR's
document.

Source-PR: #1917 (#1917)
…st-compatibility

Auto cast values on export part and partition just like insert select

Source-PR: #1779 (#1779)
Replace the export partition local manifests lock by a multiversion container

Source-PR: #1912 (#1912)
…tion_export

Preserve a few settings to partition export

Source-PR: #1990 (#1990)
…vels

Change export partition log levels

Source-PR: #2004 (#2004)
…next commit)

---
Original cherry-pick message follows:

Merge pull request #1984 from Altinity/export-partition-retry-backoff

Partition export per part local backoff policy
# Conflicts:
#	src/Core/Settings.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp
Settings.cpp: kept both obsolete-setting rows (base branch's allow_experimental_query_deduplication and the PR's export_merge_tree_partition_max_retries).

IcebergMetadata.cpp: added only the PR's new error codes METADATA_MISMATCH and UNFINISHED; INCORRECT_DATA was context in the source PR's diff and is unused on antalya-26.6, so it was not imported.

Source-PR: #1984 (#1984)
@zvonand zvonand added ai-resolved Port conflict auto-resolved by Claude and removed ai-needs-attention Releasy stopped on a conflict it could not resolve — needs human review labels Aug 6, 2026
@zvonand
zvonand marked this pull request as ready for review August 6, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-resolved Port conflict auto-resolved by Claude antalya-26.6 forwardport This is a frontport of code that existed in previous Antalya versions releasy Created/managed by RelEasy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants