Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd83ee62

Browse files
committed
Corrections to replication slots code and documentation.
Andres Freund, per a report from Vik Faering
1 parent45ffeb7 commitd83ee62

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16317,10 +16317,10 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
1631716317
<indexterm>
1631816318
<primary>pg_create_physical_replication_slot</primary>
1631916319
</indexterm>
16320-
<literal><function>pg_create_physical_replication_slot(<parameter>slotname</parameter> <type>text</type>, <parameter>plugin</parameter> <type>text</type>)</function></literal>
16320+
<literal><function>pg_create_physical_replication_slot(<parameter>slotname</parameter> <type>name</type>)</function></literal>
1632116321
</entry>
1632216322
<entry>
16323-
(<parameter>slotname</parameter> <type>text</type>, <parameter>xlog_position</parameter> <type>pg_lsn</type>)
16323+
(<parameter>slotname</parameter> <type>name</type>, <parameter>xlog_position</parameter> <type>pg_lsn</type>)
1632416324
</entry>
1632516325
<entry>
1632616326
Creates a new physical replication slot named
@@ -16335,10 +16335,10 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
1633516335
<indexterm>
1633616336
<primary>pg_drop_replication_slot</primary>
1633716337
</indexterm>
16338-
<literal><function>pg_drop_replication_slot(<parameter>slotname</parameter> <type>text</type>)</function></literal>
16338+
<literal><function>pg_drop_replication_slot(<parameter>slotname</parameter> <type>name</type>)</function></literal>
1633916339
</entry>
1634016340
<entry>
16341-
(<parameter>slotname</parameter> <type>text</type>)
16341+
<type>void</type>
1634216342
</entry>
1634316343
<entry>
1634416344
Drops the physical or logical replication slot

‎doc/src/sgml/high-availability.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
935935
postgres=# SELECT * FROM pg_replication_slots;
936936
slot_name | slot_type | datoid | database | active | xmin | restart_lsn
937937
-------------+-----------+--------+----------+--------+------+-------------
938-
node_a_slot | physical |0 | | f | |
938+
node_a_slot | physical | | | f | |
939939
(1 row)
940940
</programlisting>
941941
To configure the standby to use this slot, <varname>primary_slotname</>

‎src/backend/replication/slotfuncs.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pg_create_physical_replication_slot(PG_FUNCTION_ARGS)
5656
/* acquire replication slot, this will check for conflicting names*/
5757
ReplicationSlotCreate(NameStr(*name), false);
5858

59-
values[0]=CStringGetTextDatum(NameStr(MyReplicationSlot->data.name));
59+
values[0]=NameGetDatum(&MyReplicationSlot->data.name);
6060

6161
nulls[0]= false;
6262
nulls[1]= true;
@@ -141,7 +141,8 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
141141
XLogRecPtrrestart_lsn;
142142
boolactive;
143143
Oiddatabase;
144-
constchar*slot_name;
144+
NameDataslot_name;
145+
145146
inti;
146147

147148
SpinLockAcquire(&slot->mutex);
@@ -155,7 +156,7 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
155156
xmin=slot->data.xmin;
156157
database=slot->data.database;
157158
restart_lsn=slot->data.restart_lsn;
158-
slot_name=pstrdup(NameStr(slot->data.name));
159+
namecpy(&slot_name,&slot->data.name);
159160

160161
active=slot->active;
161162
}
@@ -164,12 +165,15 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
164165
memset(nulls,0,sizeof(nulls));
165166

166167
i=0;
167-
values[i++]=CStringGetTextDatum(slot_name);
168+
values[i++]=NameGetDatum(&slot_name);
168169
if (database==InvalidOid)
169170
values[i++]=CStringGetTextDatum("physical");
170171
else
171172
values[i++]=CStringGetTextDatum("logical");
172-
values[i++]=database;
173+
if (database==InvalidOid)
174+
nulls[i++]= true;
175+
else
176+
values[i++]=database;
173177
values[i++]=BoolGetDatum(active);
174178
if (xmin!=InvalidTransactionId)
175179
values[i++]=TransactionIdGetDatum(xmin);

‎src/include/catalog/pg_proc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4800,11 +4800,11 @@ DATA(insert OID = 3473 ( spg_range_quad_leaf_consistentPGNSP PGUID 12 1 0 0 0
48004800
DESCR("SP-GiST support for quad tree over range");
48014801

48024802
/* replication slots */
4803-
DATA(insertOID=3779 (pg_create_physical_replication_slotPGNSPPGUID121000ffffffv102249"19""{19,25,3220}""{i,o,o}""{slotname,slotname,xlog_position}"_null_pg_create_physical_replication_slot_null__null__null_ ));
4803+
DATA(insertOID=3779 (pg_create_physical_replication_slotPGNSPPGUID121000ffffffv102249"19""{19,19,3220}""{i,o,o}""{slotname,slotname,xlog_position}"_null_pg_create_physical_replication_slot_null__null__null_ ));
48044804
DESCR("create a physical replication slot");
48054805
DATA(insertOID=3780 (pg_drop_replication_slotPGNSPPGUID121000ffffffv102278"19"_null__null__null__null_pg_drop_replication_slot_null__null__null_ ));
48064806
DESCR("drop a replication slot");
4807-
DATA(insertOID=3781 (pg_get_replication_slotsPGNSPPGUID1211000fffffts002249"""{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_ ));
4807+
DATA(insertOID=3781 (pg_get_replication_slotsPGNSPPGUID1211000fffffts002249"""{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_ ));
48084808
DESCR("information about replication slots currently in use");
48094809

48104810
/* event triggers */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp