Skip to content

Don't set filesystem_cache_boundary_alignment too high #85552

Closed

Description

@PedroTadim

Describe the bug

Easy to reproduce

How to reproduce

With these settings:

  <remote_servers>
      <cluster0>
          <shard>
              <replica>
                  <host>node1</host>
                  <port>9000</port>
              </replica>
          </shard>
          <shard>
              <replica>
                  <host>node2</host>
                  <port>9000</port>
              </replica>
          </shard>
      </cluster0>
  </remote_servers>
  <filesystem_caches>
      <fcache0>
          <max_size>1Ki</max_size>
          <path>/var/lib/clickhouse/fcache0/</path>
      </fcache0>
  </filesystem_caches>

Run:

CREATE TABLE t0 (c0 Int, c1 String) ENGINE = IcebergS3(s3, filename = 't0/', format = 'CSV');
CREATE TABLE t1 (c0 Int, c1 Array(String)) ENGINE = Distributed('cluster0', default, t0);
REPLACE TABLE t1 (c0 String, c1 Int) ENGINE = S3(s3, filename = 't1/', format = 'CSV');
CREATE MATERIALIZED VIEW v0 TO t0 (c1 Int, c0 String) AS (SELECT 1 c0, 'a' c1 FROM t1);
INSERT INTO TABLE t1 (c0, c1) SETTINGS filesystem_cache_boundary_alignment = 18446744073709551615, filesystem_cache_name = 'fcache0' VALUES (1, 1);

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'size <= aligned_size'.
<Fatal> : Stack trace (when copying this message, always include the lines below):

0. src/Common/StackTrace.cpp:389: StackTrace::StackTrace() @ 0x000000001432da64
1. src/Common/Exception.cpp:56: DB::abortOnFailedAssertion(String const&) @ 0x0000000014287315
2. src/Interpreters/Cache/FileCache.cpp:415: DB::FileCache::splitRange(unsigned long, unsigned long, unsigned long) @ 0x000000001b5f308f
3. src/Interpreters/Cache/FileCache.cpp:775: DB::FileCache::getOrSet(DB::FileCacheKey const&, unsigned long, unsigned long, unsigned long, DB::CreateFileSegmentSettings const&, unsigned long, DB::FileCacheUserInfo const&, std::optional<unsigned long>) @ 0x000000001b5f4bf4
4. src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp:146: DB::CachedOnDiskReadBufferFromFile::nextFileSegmentsBatch() @ 0x00000000197cbbd2
5. src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp:165: DB::CachedOnDiskReadBufferFromFile::initialize() @ 0x00000000197cbe30
6. src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp:1357: DB::CachedOnDiskReadBufferFromFile::isContentCached(unsigned long, unsigned long) @ 0x00000000197d93b1
7. src/Disks/IO/ThreadPoolRemoteFSReader.cpp:94: DB::ThreadPoolRemoteFSReader::submit(DB::IAsynchronousReader::Request) @ 0x00000000196466b3
8. src/Disks/IO/AsynchronousBoundedReadBuffer.cpp:114: DB::AsynchronousBoundedReadBuffer::readAsync(char*, unsigned long, Priority) @ 0x00000000197c6b88
9. src/Disks/IO/AsynchronousBoundedReadBuffer.cpp:140: DB::AsynchronousBoundedReadBuffer::prefetch(Priority) @ 0x00000000197c6eec
10. src/Storages/ObjectStorage/StorageObjectStorageSource.cpp:783: DB::StorageObjectStorageSource::createReadBuffer(DB::RelativePathWithMetadata&, std::shared_ptr<DB::IObjectStorage> const&, std::shared_ptr<DB::Context const> const&, std::shared_ptr<Poco::Logger> const&, std::optional<DB::ReadSettings> const&) @ 0x00000000197b2263
11. src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp:278: DB::getMetadataJSONObject(String const&, std::shared_ptr<DB::IObjectStorage>, std::shared_ptr<DB::StorageObjectStorageConfiguration>, std::shared_ptr<DB::IcebergMetadataFilesCache>, std::shared_ptr<DB::Context const> const&, std::shared_ptr<Poco::Logger>, DB::CompressionMethod)::$_0::operator()() const @ 0x000000001994f2b6
12. src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp:295: DB::getMetadataJSONObject(String const&, std::shared_ptr<DB::IObjectStorage>, std::shared_ptr<DB::StorageObjectStorageConfiguration>, std::shared_ptr<DB::IcebergMetadataFilesCache>, std::shared_ptr<DB::Context const> const&, std::shared_ptr<Poco::Logger>, DB::CompressionMethod) @ 0x000000001994e831
13. src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp:697: DB::IcebergStorageSink::IcebergStorageSink(std::shared_ptr<DB::IObjectStorage>, std::shared_ptr<DB::StorageObjectStorageConfiguration>, std::optional<DB::FormatSettings> const&, std::shared_ptr<DB::Block const>, std::shared_ptr<DB::Context const>, std::shared_ptr<DataLake::ICatalog>, DB::StorageID const&) @ 0x0000000019902d3b
14. contrib/llvm-project/libcxx/include/__memory/construct_at.h:41: std::shared_ptr<DB::IcebergStorageSink> std::allocate_shared[abi:se190107]<DB::IcebergStorageSink, std::allocator<DB::IcebergStorageSink>, std::shared_ptr<DB::IObjectStorage> const&, std::shared_ptr<DB::StorageObjectStorageConfiguration>&, std::optional<DB::FormatSettings> const&, std::shared_ptr<DB::Block const> const&, std::shared_ptr<DB::Context const>&, std::shared_ptr<DataLake::ICatalog>&, DB::StorageID&, 0>(std::allocator<DB::IcebergStorageSink> const&, std::shared_ptr<DB::IObjectStorage> const&, std::shared_ptr<DB::StorageObjectStorageConfiguration>&, std::optional<DB::FormatSettings> const&, std::shared_ptr<DB::Block const> const&, std::shared_ptr<DB::Context const>&, std::shared_ptr<DataLake::ICatalog>&, DB::StorageID&) @ 0x000000001973db02
15. contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:851: DB::StorageObjectStorage::write(std::shared_ptr<DB::IAST> const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::shared_ptr<DB::Context const>, bool) @ 0x0000000019739239
16. src/Interpreters/InsertDependenciesBuilder.cpp:1336: DB::InsertDependenciesBuilder::createSink(DB::InsertDependenciesBuilder::StorageIDPrivate) const @ 0x000000001b20f16a
17. src/Interpreters/InsertDependenciesBuilder.cpp:1370: DB::InsertDependenciesBuilder::createPostSink(DB::InsertDependenciesBuilder::StorageIDPrivate) const @ 0x000000001b20fa32
18. src/Interpreters/InsertDependenciesBuilder.cpp:797: DB::InsertDependenciesBuilder::createChainWithDependencies() const @ 0x000000001b20dd51
19. src/Interpreters/InterpreterInsertQuery.cpp:694: DB::InterpreterInsertQuery::buildInsertPipeline(DB::ASTInsertQuery&, std::shared_ptr<DB::IStorage>) @ 0x000000001b201e54
20. src/Interpreters/InterpreterInsertQuery.cpp:906: DB::InterpreterInsertQuery::execute() @ 0x000000001b204730
21. src/Interpreters/executeQuery.cpp:1561: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>) @ 0x000000001b564597
22. src/Interpreters/executeQuery.cpp:1770: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x000000001b55fa05
23. src/Server/TCPHandler.cpp:739: DB::TCPHandler::runImpl() @ 0x000000001ee8418f
24. src/Server/TCPHandler.cpp:2740: DB::TCPHandler::run() @ 0x000000001ee9e024
25. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x00000000270ab647
26. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x00000000270abc25
27. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000002704adff
28. base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x00000000270484d1
29. start_thread @ 0x00000000000a27f1
30. __clone3 @ 0x0000000000133c9c

Activity

  1. added
    minor
    fuzz
    on Aug 13, 2025
  2. self-assigned this
    on Dec 17, 2025
  3. bharatnc commented on Jan 12, 2026

    @bharatnc
    Contributor

    I'm not able to reproduce this anymore in master.

  4. PedroTadim commented on Jan 12, 2026

    @PedroTadim
    MemberAuthor

    Me neither, we can close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

fuzzminor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions