2022-06-15 17:54:46 +00:00
|
|
|
-- Tags: no-s3-storage, no-tsan
|
2022-03-15 13:52:34 +00:00
|
|
|
-- FIXME this test fails with S3 due to a bug in DiskCacheWrapper
|
2022-06-15 17:54:46 +00:00
|
|
|
-- FIXME should work with tsan
|
2021-04-09 12:53:51 +00:00
|
|
|
drop table if exists txn_counters;
|
|
|
|
|
2022-01-28 17:47:37 +00:00
|
|
|
create table txn_counters (n Int64, creation_tid DEFAULT transactionID()) engine=MergeTree order by n;
|
2021-04-09 12:53:51 +00:00
|
|
|
|
|
|
|
insert into txn_counters(n) values (1);
|
|
|
|
select transactionID();
|
|
|
|
|
2021-06-11 12:14:38 +00:00
|
|
|
-- stop background cleanup
|
|
|
|
system stop merges txn_counters;
|
|
|
|
|
2022-01-31 22:27:55 +00:00
|
|
|
set throw_on_unsupported_query_inside_transaction=0;
|
|
|
|
|
2021-04-09 12:53:51 +00:00
|
|
|
begin transaction;
|
|
|
|
insert into txn_counters(n) values (2);
|
2022-01-28 17:47:37 +00:00
|
|
|
select 1, system.parts.name, txn_counters.creation_tid = system.parts.creation_tid from txn_counters join system.parts on txn_counters._part = system.parts.name where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
|
|
|
select 2, name, creation_csn, removal_tid, removal_csn from system.parts where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
2021-04-09 12:53:51 +00:00
|
|
|
rollback;
|
|
|
|
|
|
|
|
begin transaction;
|
|
|
|
insert into txn_counters(n) values (3);
|
2022-01-28 17:47:37 +00:00
|
|
|
select 3, system.parts.name, txn_counters.creation_tid = system.parts.creation_tid from txn_counters join system.parts on txn_counters._part = system.parts.name where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
|
|
|
select 4, name, creation_csn, removal_tid, removal_csn from system.parts where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
2021-11-08 18:56:09 +00:00
|
|
|
select 5, transactionID().3 == serverUUID();
|
2021-04-09 12:53:51 +00:00
|
|
|
commit;
|
|
|
|
|
2021-12-30 13:15:28 +00:00
|
|
|
detach table txn_counters;
|
|
|
|
attach table txn_counters;
|
|
|
|
|
|
|
|
begin transaction;
|
|
|
|
insert into txn_counters(n) values (4);
|
2022-01-28 17:47:37 +00:00
|
|
|
select 6, system.parts.name, txn_counters.creation_tid = system.parts.creation_tid from txn_counters join system.parts on txn_counters._part = system.parts.name where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
|
|
|
select 7, name, removal_tid, removal_csn from system.parts where database=currentDatabase() and table='txn_counters' order by system.parts.name;
|
2021-12-30 13:15:28 +00:00
|
|
|
select 8, transactionID().3 == serverUUID();
|
|
|
|
commit;
|
|
|
|
|
2022-01-14 14:03:00 +00:00
|
|
|
begin transaction;
|
|
|
|
insert into txn_counters(n) values (5);
|
|
|
|
alter table txn_counters drop partition id 'all';
|
|
|
|
rollback;
|
|
|
|
|
|
|
|
system flush logs;
|
|
|
|
select indexOf((select arraySort(groupUniqArray(tid)) from system.transactions_info_log where database=currentDatabase() and table='txn_counters'), tid),
|
2022-05-20 20:08:46 +00:00
|
|
|
(toDecimal64(now64(6), 6) - toDecimal64(event_time, 6)) < 100,
|
|
|
|
type,
|
|
|
|
thread_id!=0,
|
|
|
|
length(query_id)=length(queryID()) or type='Commit' and query_id='', -- ignore fault injection after commit
|
|
|
|
tid_hash!=0,
|
|
|
|
csn=0,
|
|
|
|
part
|
2022-01-14 14:03:00 +00:00
|
|
|
from system.transactions_info_log
|
|
|
|
where tid in (select tid from system.transactions_info_log where database=currentDatabase() and table='txn_counters' and not (tid.1=1 and tid.2=1))
|
|
|
|
or (database=currentDatabase() and table='txn_counters') order by event_time;
|
2021-12-30 13:15:28 +00:00
|
|
|
|
2022-02-14 19:47:17 +00:00
|
|
|
drop table txn_counters;
|