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
d83ee622
Commit
d83ee622
authored
Mar 03, 2014
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrections to replication slots code and documentation.
Andres Freund, per a report from Vik Faering
parent
45ffeb7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
doc/src/sgml/func.sgml
doc/src/sgml/func.sgml
+4
-4
doc/src/sgml/high-availability.sgml
doc/src/sgml/high-availability.sgml
+1
-1
src/backend/replication/slotfuncs.c
src/backend/replication/slotfuncs.c
+9
-5
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+2
-2
No files found.
doc/src/sgml/func.sgml
View file @
d83ee622
...
...
@@ -16317,10 +16317,10 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
<indexterm>
<primary>
pg_create_physical_replication_slot
</primary>
</indexterm>
<literal><function>
pg_create_physical_replication_slot(
<parameter>
slotname
</parameter>
<type>
text
</type>
,
<parameter>
plugin
</parameter>
<type>
text
</type>
)
</function></literal>
<literal><function>
pg_create_physical_replication_slot(
<parameter>
slotname
</parameter>
<type>
name
</type>
)
</function></literal>
</entry>
<entry>
(
<parameter>
slotname
</parameter>
<type>
text
</type>
,
<parameter>
xlog_position
</parameter>
<type>
pg_lsn
</type>
)
(
<parameter>
slotname
</parameter>
<type>
name
</type>
,
<parameter>
xlog_position
</parameter>
<type>
pg_lsn
</type>
)
</entry>
<entry>
Creates a new physical replication slot named
...
...
@@ -16335,10 +16335,10 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
<indexterm>
<primary>
pg_drop_replication_slot
</primary>
</indexterm>
<literal><function>
pg_drop_replication_slot(
<parameter>
slotname
</parameter>
<type>
text
</type>
)
</function></literal>
<literal><function>
pg_drop_replication_slot(
<parameter>
slotname
</parameter>
<type>
name
</type>
)
</function></literal>
</entry>
<entry>
(
<parameter>
slotname
</parameter>
<type>
text
</type>
)
<type>
void
</type>
</entry>
<entry>
Drops the physical or logical replication slot
...
...
doc/src/sgml/high-availability.sgml
View file @
d83ee622
...
...
@@ -935,7 +935,7 @@ postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
postgres=# SELECT * FROM pg_replication_slots;
slot_name | slot_type | datoid | database | active | xmin | restart_lsn
-------------+-----------+--------+----------+--------+------+-------------
node_a_slot | physical |
0
| | f | |
node_a_slot | physical |
| | f | |
(1 row)
</programlisting>
To configure the standby to use this slot, <varname>primary_slotname</>
...
...
src/backend/replication/slotfuncs.c
View file @
d83ee622
...
...
@@ -56,7 +56,7 @@ pg_create_physical_replication_slot(PG_FUNCTION_ARGS)
/* acquire replication slot, this will check for conflicting names*/
ReplicationSlotCreate
(
NameStr
(
*
name
),
false
);
values
[
0
]
=
CStringGetTextDatum
(
NameStr
(
MyReplicationSlot
->
data
.
name
)
);
values
[
0
]
=
NameGetDatum
(
&
MyReplicationSlot
->
data
.
name
);
nulls
[
0
]
=
false
;
nulls
[
1
]
=
true
;
...
...
@@ -141,7 +141,8 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
XLogRecPtr
restart_lsn
;
bool
active
;
Oid
database
;
const
char
*
slot_name
;
NameData
slot_name
;
int
i
;
SpinLockAcquire
(
&
slot
->
mutex
);
...
...
@@ -155,7 +156,7 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
xmin
=
slot
->
data
.
xmin
;
database
=
slot
->
data
.
database
;
restart_lsn
=
slot
->
data
.
restart_lsn
;
slot_name
=
pstrdup
(
NameStr
(
slot
->
data
.
name
)
);
namecpy
(
&
slot_name
,
&
slot
->
data
.
name
);
active
=
slot
->
active
;
}
...
...
@@ -164,12 +165,15 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
memset
(
nulls
,
0
,
sizeof
(
nulls
));
i
=
0
;
values
[
i
++
]
=
CStringGetTextDatum
(
slot_name
);
values
[
i
++
]
=
NameGetDatum
(
&
slot_name
);
if
(
database
==
InvalidOid
)
values
[
i
++
]
=
CStringGetTextDatum
(
"physical"
);
else
values
[
i
++
]
=
CStringGetTextDatum
(
"logical"
);
values
[
i
++
]
=
database
;
if
(
database
==
InvalidOid
)
nulls
[
i
++
]
=
true
;
else
values
[
i
++
]
=
database
;
values
[
i
++
]
=
BoolGetDatum
(
active
);
if
(
xmin
!=
InvalidTransactionId
)
values
[
i
++
]
=
TransactionIdGetDatum
(
xmin
);
...
...
src/include/catalog/pg_proc.h
View file @
d83ee622
...
...
@@ -4800,11 +4800,11 @@ DATA(insert OID = 3473 ( spg_range_quad_leaf_consistent PGNSP PGUID 12 1 0 0 0
DESCR
(
"SP-GiST support for quad tree over range"
);
/* replication slots */
DATA
(
insert
OID
=
3779
(
pg_create_physical_replication_slot
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
f
f
v
1
0
2249
"19"
"{19,
25
,3220}"
"{i,o,o}"
"{slotname,slotname,xlog_position}"
_null_
pg_create_physical_replication_slot
_null_
_null_
_null_
));
DATA
(
insert
OID
=
3779
(
pg_create_physical_replication_slot
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
f
f
v
1
0
2249
"19"
"{19,
19
,3220}"
"{i,o,o}"
"{slotname,slotname,xlog_position}"
_null_
pg_create_physical_replication_slot
_null_
_null_
_null_
));
DESCR
(
"create a physical replication slot"
);
DATA
(
insert
OID
=
3780
(
pg_drop_replication_slot
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
f
f
v
1
0
2278
"19"
_null_
_null_
_null_
_null_
pg_drop_replication_slot
_null_
_null_
_null_
));
DESCR
(
"drop a replication slot"
);
DATA
(
insert
OID
=
3781
(
pg_get_replication_slots
PGNSP
PGUID
12
1
10
0
0
f
f
f
f
f
t
s
0
0
2249
""
"{
25
,25,26,16,28,3220}"
"{o,o,o,o,o,o}"
"{slot_name,slot_type,datoid,active,xmin,restart_lsn}"
_null_
pg_get_replication_slots
_null_
_null_
_null_
));
DATA
(
insert
OID
=
3781
(
pg_get_replication_slots
PGNSP
PGUID
12
1
10
0
0
f
f
f
f
f
t
s
0
0
2249
""
"{
19
,25,26,16,28,3220}"
"{o,o,o,o,o,o}"
"{slot_name,slot_type,datoid,active,xmin,restart_lsn}"
_null_
pg_get_replication_slots
_null_
_null_
_null_
));
DESCR
(
"information about replication slots currently in use"
);
/* event triggers */
...
...
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