Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
70c56a01
Commit
70c56a01
authored
Jan 23, 2017
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NULL pointer access in logical replication workers
From: Petr Jelinek <pjmodos@pjmodos.net>
parent
6cffe54a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
src/backend/replication/logical/launcher.c
src/backend/replication/logical/launcher.c
+14
-3
src/backend/replication/logical/worker.c
src/backend/replication/logical/worker.c
+12
-12
No files found.
src/backend/replication/logical/launcher.c
View file @
70c56a01
...
...
@@ -349,10 +349,21 @@ logicalrep_worker_stop(Oid subid)
ResetLatch
(
&
MyProc
->
procLatch
);
/* Check
if the worker has started
. */
/* Check
worker status
. */
LWLockAcquire
(
LogicalRepWorkerLock
,
LW_SHARED
);
worker
=
logicalrep_worker_find
(
subid
);
if
(
!
worker
||
worker
->
proc
)
/*
* Worker is no longer associated with subscription. It must have
* exited, nothing more for us to do.
*/
if
(
worker
->
subid
==
InvalidOid
)
{
LWLockRelease
(
LogicalRepWorkerLock
);
return
;
}
/* Worker has assigned proc, so it has started. */
if
(
worker
->
proc
)
break
;
}
...
...
src/backend/replication/logical/worker.c
View file @
70c56a01
...
...
@@ -1219,14 +1219,15 @@ reread_subscription(void)
newsub
=
GetSubscription
(
MyLogicalRepWorker
->
subid
,
true
);
/*
* Exit if connection string was changed. The launcher will start
* new worker.
* Exit if the subscription was removed.
* This normally should not happen as the worker gets killed
* during DROP SUBSCRIPTION.
*/
if
(
strcmp
(
newsub
->
conninfo
,
MySubscription
->
conninfo
)
!=
0
)
if
(
!
newsub
)
{
ereport
(
LOG
,
(
errmsg
(
"logical replication worker for subscription
\"
%s
\"
will "
"
restart because the connection information was chang
ed"
,
"
stop because the subscription was remov
ed"
,
MySubscription
->
name
)));
walrcv_disconnect
(
wrconn
);
...
...
@@ -1234,14 +1235,14 @@ reread_subscription(void)
}
/*
* Exit if
publication list
was changed. The launcher will start
* Exit if
connection string
was changed. The launcher will start
* new worker.
*/
if
(
!
equal
(
newsub
->
publications
,
MySubscription
->
publications
)
)
if
(
strcmp
(
newsub
->
conninfo
,
MySubscription
->
conninfo
)
!=
0
)
{
ereport
(
LOG
,
(
errmsg
(
"logical replication worker for subscription
\"
%s
\"
will "
"restart because
subscription's publications were
changed"
,
"restart because
the connection information was
changed"
,
MySubscription
->
name
)));
walrcv_disconnect
(
wrconn
);
...
...
@@ -1249,15 +1250,14 @@ reread_subscription(void)
}
/*
* Exit if the subscription was removed.
* This normally should not happen as the worker gets killed
* during DROP SUBSCRIPTION.
* Exit if publication list was changed. The launcher will start
* new worker.
*/
if
(
!
newsub
)
if
(
!
equal
(
newsub
->
publications
,
MySubscription
->
publications
)
)
{
ereport
(
LOG
,
(
errmsg
(
"logical replication worker for subscription
\"
%s
\"
will "
"
stop because the subscription was remov
ed"
,
"
restart because subscription's publications were chang
ed"
,
MySubscription
->
name
)));
walrcv_disconnect
(
wrconn
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment