This commit is contained in:
Alexander Tokmakov 2022-03-15 00:08:25 +01:00
parent 9702b5177d
commit c8d6c13c2d
2 changed files with 16 additions and 15 deletions

View File

@ -147,7 +147,8 @@ void MergeTreeTransaction::beforeCommit()
for (const auto & table_and_mutation : mutations_to_wait)
table_and_mutation.first->waitForMutation(table_and_mutation.second);
assert([&]() {
assert([&]()
{
std::lock_guard lock{mutex};
return mutations == mutations_to_wait;
}());

View File

@ -70,24 +70,24 @@ def test_rollback_unfinished_on_restart(start_cluster):
node.restart_clickhouse(kill=True)
assert node.query('select *, _part from mt order by n') == '2\t20\t0_2_2_0\n3\t30\t1_3_3_0\n4\t40\t0_4_4_0\n9\t90\t1_5_5_0\n'
res = node.query("select name, active, creation_tid, 'csn' || toString(creation_csn), removal_tid, 'csn' || toString(removal_csn) from system.parts where table='mt' order by name")
res = node.query("select name, active, creation_tid, 'csn' || toString(creation_csn) || '_', removal_tid, 'csn' || toString(removal_csn) || '_' from system.parts where table='mt' order by name")
res = res.replace(tid0, 'tid0')
res = res.replace(tid1, 'tid1').replace('csn' + csn1, 'csn_1')
res = res.replace(tid2, 'tid2').replace('csn' + csn2, 'csn_2')
res = res.replace(tid1, 'tid1').replace('csn' + csn1 + '_', 'csn_1')
res = res.replace(tid2, 'tid2').replace('csn' + csn2 + '_', 'csn_2')
res = res.replace(tid3, 'tid3')
res = res.replace(tid4, 'tid4')
res = res.replace(tid5, 'tid5')
res = res.replace(tid6, 'tid6').replace('csn' + csn6, 'csn_6')
assert res == "0_2_2_0\t1\ttid0\tcsn1\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"0_2_4_1\t0\ttid4\tcsn18446744073709551615\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"0_4_4_0\t1\ttid2\tcsn_2\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"0_8_8_0\t0\ttid5\tcsn18446744073709551615\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"1_1_1_0\t0\ttid0\tcsn1\ttid1\tcsn_1\n" \
"1_3_3_0\t1\ttid2\tcsn_2\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"1_3_3_0_7\t0\ttid3\tcsn18446744073709551615\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"1_5_5_0\t1\ttid6\tcsn_6\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"1_6_6_0\t0\ttid3\tcsn18446744073709551615\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n" \
"1_6_6_0_7\t0\ttid3\tcsn18446744073709551615\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0\n"
res = res.replace(tid6, 'tid6').replace('csn' + csn6 + '_', 'csn_6')
assert res == "0_2_2_0\t1\ttid0\tcsn1_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"0_2_4_1\t0\ttid4\tcsn18446744073709551615_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"0_4_4_0\t1\ttid2\tcsn_2\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"0_8_8_0\t0\ttid5\tcsn18446744073709551615_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"1_1_1_0\t0\ttid0\tcsn1_\ttid1\tcsn_1\n" \
"1_3_3_0\t1\ttid2\tcsn_2\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"1_3_3_0_7\t0\ttid3\tcsn18446744073709551615_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"1_5_5_0\t1\ttid6\tcsn_6\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"1_6_6_0\t0\ttid3\tcsn18446744073709551615_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n" \
"1_6_6_0_7\t0\ttid3\tcsn18446744073709551615_\t(0,0,'00000000-0000-0000-0000-000000000000')\tcsn0_\n"