Repository navigation
Reject metadata_type = web on a non-web object storage - #119818
PedroTadim merged 2 commits into
Conversation
A disk configured with metadata_type = web (or web_index) on top of a
non-web object storage crashed the server with a SIGSEGV, reachable from a
single CREATE TABLE:
CREATE TABLE t (a Int32) ENGINE = MergeTree ORDER BY a
SETTINGS disk = disk(name='d', type='object_storage',
object_storage_type='local', path='/tmp/blobs/',
metadata_type='web', read_only=1, skip_access_check=1);
Nothing validated the object_storage_type / metadata_type pairing: an
explicit metadata_type overrides the compatibility hint unconditionally,
and the two handlers that require a concrete WebObjectStorage asserted that
requirement with assert_cast. That typeid check is compiled out in this
translation unit, because assert_cast.h does not include the header that
defines DEBUG_OR_SANITIZER_BUILD and it was this file's first include, so
the cast was a bare static_cast in every build flavour. A LocalObjectStorage
was reinterpreted as a WebObjectStorage and getBaseURL() read
url_shards.front().front() at a bogus offset, reached from
MergeTreeData::initializeDirectoriesAndFormatVersion.
Both downcasts now go through one helper that does a dynamic_cast and
throws INVALID_CONFIG_PARAMETER, validating and casting in one operation.
The metadata storage factory is the single choke point for XML config,
SETTINGS disk = disk(...), ATTACH and table load, so no path can hand a
non-web object storage to these two metadata storages any more.
Reproduced on official builds 26.8.2.3 and 26.9.1.410.
Closes ClickHouse#119798
Internal second-model review: adjudication log (click to expand)Pre-publication review: my own cold read of the diff first, then an independent model
Severity: ❌ blocker / Checks I ran while reading, recorded because they are the ones that would have caught a bad fix:
One thing I noticed and am not raising: Session id: cron:clickhouse-review-slot-8:20260913-172400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260913-164502 |
|
Workflow [PR], commit [90a728e] Summary: ❌
AI ReviewSummaryThis PR hardens Final Verdict✅ No new findings. I did not post any inline review comments. LLVM Coverage ReportMeasured on commit 90a728e.
Changed lines: Changed C/C++ lines covered: 14/15 (93.33%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 17 s compile time in total, 8 of them have a recent master baseline. |
CI finish ledger - af61629Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Session id: cron:our-pr-ci-monitor:20260913-223048 |
…-metadata-type-check
22be007
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a crash when a disk is configured with
metadata_type = webormetadata_type = web_indexon top of a non-web object storage. Such a configuration is now rejected withINVALID_CONFIG_PARAMETERinstead of interpreting an unrelated object storage as a web one. Closes #119798.Description
Closes #119798
A single
CREATE TABLEterminated the server:I reproduced the SIGSEGV on official builds 26.8.2.3 and 26.9.1.410, and on a debug build of
master.
metadata_type = web_indexfails identically.Root cause: nothing validated the
object_storage_type/metadata_typepairing. An explicitmetadata_typeoverrides the compatibility hint unconditionally, and theweb/web_indexhandlers asserted their requirement with
assert_cast, whose typeid check is compiled out in thistranslation unit (
assert_cast.hdoes not include the header that definesDEBUG_OR_SANITIZER_BUILD, and it was this file's first include). ALocalObjectStoragewastherefore
static_casttoWebObjectStorage, andgetBaseURL()readurl_shardsat a bogusoffset from
MergeTreeData::initializeDirectoriesAndFormatVersion.Change: both downcasts now go through one helper doing
dynamic_castplus a typedINVALID_CONFIG_PARAMETER, in the metadata storage factory that is the single choke point for XMLconfig,
SETTINGS disk = disk(...), ATTACH and table load. No setting, no default and no formatchange; the only configurations affected are the ones that today reinterpret one object storage as
another, and they are now rejected when the disk is created.
Validation: the two new cases in
02963_test_flexible_disk_configurationfail on master and passwith the fix (50/50 repeats clean); the existing
type = webdisk tests03057,03355,03823and
04033all still pass, which is what would catch a guard wrongly rejecting a real web disk.Workflow [PR]
Sync PR [sync-upstream/pr/119818]
Version info
26.9.1.1510(included in26.9and later)