ClickHouse / ClickHouse/ClickHouse

Issues with persistency in storage `File`/`S3`/… with setting `engine_file_allow_create_multiple_files`

Open
#64,052 2 comments 0 reactions 0 assignees View on GitHub
comp-table-functions unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

**Describe the unexpected behaviour**
All files created by storage with setting `engine_file_allow_create_multiple_files` except the first one are not visible by the storage after restart.

**How to reproduce**
```sql
DROP TABLE IF EXISTS test_file_insert;

CREATE TABLE test_file_insert (x UInt64) ENGINE = File(JSON, 'test_file.json');

SET engine_file_allow_create_multiple_files = 1;

INSERT INTO test_file_insert SELECT * FROM numbers(10);

INSERT INTO test_file_insert SELECT * FROM numbers(10);

SELECT _file, count() FROM test_file_insert GROUP BY _file ORDER BY _file ASC;

┌─_file────────────┬─count()─┐
1. │ test_file.1.json │ 10 │
2. │ test_file.json │ 10 │
└──────────────────┴─────────┘

DETACH TABLE test_file_insert;
ATTACH TABLE test_file_insert;

SELECT _file, count() FROM test_file_insert GROUP BY _file ORDER BY _file ASC;

┌─_file──────────┬─count()─┐
1. │ test_file.json │ 10 │
└────────────────┴─────────┘
```

**Expected behavior**
The persistent storage with engine `File` should read from the same set of files after restart.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.