用于交换两个表的文档声明原子性,但是多个表怎么办?下面的查询运行良好,并在表A <=> B和C <=> D中执行交换
EXCHANGE TABLES "default"."A" AND "default"."B", "default"."C" AND "default"."D"原子引擎上的EXCHANGE语句是否为多个表提供原子功能?A <=> B交换时可以是情况,但C <=> D不是吗?原子性在整个交换查询上传播吗?
发布于 2022-05-30 23:27:38
它们不是原子的。
insert into a.x1 select 1;
insert into a.x1 select 2;
exchange tables a.x1 and a.x2, a.y1 and a.y2;
Received exception from server (version 22.6.1):
Code: 521. DB::Exception: Received from localhost:9000.DB::ErrnoException: Paths cannot be exchanged because /var/lib/clickhouse/store/209/209474d2-5d64-4ca0-8b45-9abf4109235a/y1.sql or /var/lib/clickhouse/store/209/209474d2-5d64-4ca0-8b45-9abf4109235a/y2.sql does not exist, errno: 2, strerror: No such file or directory. (ATOMIC_RENAME_FAIL)
select * from a.x1;
Ok.
0 rows in set. Elapsed: 0.002 sec.
select * from a.x2
┌─A─┐
│ 2 │
└───┘
┌─A─┐
│ 1 │
└───┘Atomicy与DML事务无关。这是关于可见性的选择。查询不会看到中间状态,也不会抛出table . does not exists...。
https://stackoverflow.com/questions/72436607
复制相似问题