Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit acb4da3

Browse files
committed
fix ddl recovery PGPRO-1699
1 parent 5fdd873 commit acb4da3

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

contrib/mmts/multimaster.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5028,9 +5028,6 @@ char* MtmGucSerialize(void)
50285028

50295029
static void MtmProcessDDLCommand(char const* queryString, bool transactional)
50305030
{
5031-
if (MtmTx.isReplicated)
5032-
return;
5033-
50345031
if (transactional)
50355032
{
50365033
char *gucCtx = MtmGucSerialize();
@@ -5462,7 +5459,7 @@ static void MtmProcessUtility(PlannedStmt *pstmt,
54625459
break;
54635460
}
54645461

5465-
if (!skipCommand && !MtmTx.isReplicated && !MtmDDLStatement)
5462+
if (!skipCommand && !MtmDDLStatement)
54665463
{
54675464
MTM_LOG3("Process DDL statement '%s', MtmTx.isReplicated=%d, "
54685465
"MtmIsLogicalReceiver=%d", stmt_string, MtmTx.isReplicated,

contrib/mmts/tests_testgres/ddl.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import unittest
2+
import subprocess
3+
import time
4+
5+
from mm_cluster import Cluster
6+
7+
NUM_NODES = 3
8+
9+
class TestDDL(unittest.TestCase):
10+
11+
@classmethod
12+
def setUpClass(cls):
13+
cls.cluster = Cluster(NUM_NODES)
14+
cls.cluster.print_conninfo()
15+
cls.cluster.start().await_online((0,1,2))
16+
# cls.cluster.print_conninfo()
17+
18+
@classmethod
19+
def tearDownClass(cls):
20+
cls.cluster.stop()
21+
22+
# Check that recovery properly processes
23+
def test_dll_recovery(self):
24+
# create table while one node is stopped
25+
self.cluster.nodes[2].stop()
26+
self.cluster.await_online((0,1))
27+
self.cluster.nodes[0].safe_psql(query='create table t(id int primary key)')
28+
29+
# now if second node didn't store logical message with DDL and third
30+
# node will recover from second then it will not receive this
31+
# 'create table' (PGPRO-1699)
32+
self.cluster.nodes[2].start()
33+
self.cluster.await_online((0,1,2))
34+
self.cluster.nodes[2].safe_psql(query='insert into t values(42)')
35+
36+
37+
if __name__ == '__main__':
38+
unittest.main()

0 commit comments

Comments
 (0)