You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Insert into table using storage policy of type s3 (GCS in my use case) is not fully synchronous and subsequent move/replace partition statement referencing the data that was just inserted can't be executed right away (they work correctly if executed with a delay after the insert).
Steps to reproduce:
DROP TABLE IF EXISTS default.users ON CLUSTER '{cluster}' SETTINGS max_table_size_to_drop=0;
CREATE TABLE default.users ON CLUSTER '{cluster}' (
uid Int64,
ts Date,
age1 Decimal256(8),
age2 Decimal256(8)
)
ENGINE=ReplicatedMergeTree -- change to MergeTree and it works correctly
ORDER BY (uid, ts)
PARTITION BY (toYYYYMM(ts))
SETTINGS storage_policy = 'gcs_main' -- comment out and it works correctly
;
DROP TABLE IF EXISTS default.users1 ON CLUSTER '{cluster}' SETTINGS max_table_size_to_drop=0;
CREATE TABLE default.users1 ON CLUSTER '{cluster}' AS default.users;
DROP TABLE IF EXISTS default.users2 ON CLUSTER '{cluster}' SETTINGS max_table_size_to_drop=0;
CREATE TABLE default.users2 ON CLUSTER '{cluster}' AS default.users;
INSERT INTO default.users
SELECT
number,
dateAdd(month, -number%36, date(now())),
sum(number%3),
sum(number%3),
FROM numbers(100000)
GROUP BY 1
;
INSERT INTO default.users1
SELECT * FROM default.users WHERE toYYYYMM(ts) = '202405'
;
DELETE FROM default.users WHERE toYYYYMM(ts) = '202405';
DELETE FROM default.users2 WHERE toYYYYMM(ts) = '202405';
INSERT INTO default.users2
SELECT * FROM default.users1 WHERE toYYYYMM(ts) = '202405'
;
ALTER TABLE default.users ON CLUSTER '{cluster}' REPLACE PARTITION 202405 FROM default.users2 SETTINGS mutations_sync=2, alter_sync=2;
SELECT count(*) FROM default.users where toYYYYMM(ts) = '202405'; -- this shouldn't be zero, count users2 for confirmation
The same query works if either the engine is non-replicated or the storage policy is not of type s3.
All the queries are run on the same server and my suspect is the asynchronous part is in the insert instead of the replace partition. It's as if the replace partition command is not referencing the same data you'd get by running a select statement for some reason (i.e. there's a delay between when the two results match).
Ideally, after the insert is completed, all the following queries (select and move partitions) should reference the same underlying data.
Insert into table using storage policy of type s3 (GCS in my use case) is not fully synchronous and subsequent move/replace partition statement referencing the data that was just inserted can't be executed right away (they work correctly if executed with a delay after the insert).
Steps to reproduce:
The same query works if either the engine is non-replicated or the storage policy is not of type s3.
CH version: 24.4.1.2088
3 zk nodes
storage on GCS
settings with changed = 1:
The text was updated successfully, but these errors were encountered: