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

Commite84d243

Browse files
committed
Initialize all memory for logical replication relation cache.
As reported by buildfarm animal skink / valgrind, some of thevariables weren't always initialized. To avoid further mishaps usememset to ensure the entire entry is initialized.Author: Petr JelinekReported-By: Andres FreundDiscussion:https://postgr.es/m/20170422183123.w2jgiuxtts7qrqaq@alap3.anarazel.deBackpatch: none, code new in master
1 parent61c21dd commite84d243

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

‎src/backend/replication/logical/relation.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ logicalrep_relmap_invalidate_cb(Datum arg, Oid reloid)
8282
* Initialize the relation map cache.
8383
*/
8484
staticvoid
85-
logicalrep_relmap_init()
85+
logicalrep_relmap_init(void)
8686
{
8787
HASHCTLctl;
8888

@@ -141,19 +141,10 @@ logicalrep_relmap_free_entry(LogicalRepRelMapEntry *entry)
141141
pfree(remoterel->attnames);
142142
pfree(remoterel->atttyps);
143143
}
144-
remoterel->attnames=NULL;
145-
remoterel->atttyps=NULL;
146-
147144
bms_free(remoterel->attkeys);
148-
remoterel->attkeys=NULL;
149145

150146
if (entry->attrmap)
151147
pfree(entry->attrmap);
152-
153-
entry->attrmap=NULL;
154-
remoterel->natts=0;
155-
entry->localreloid=InvalidOid;
156-
entry->localrel=NULL;
157148
}
158149

159150
/*
@@ -182,6 +173,8 @@ logicalrep_relmap_update(LogicalRepRelation *remoterel)
182173
if (found)
183174
logicalrep_relmap_free_entry(entry);
184175

176+
memset(entry,0,sizeof(LogicalRepRelMapEntry));
177+
185178
/* Make cached copy of the data */
186179
oldctx=MemoryContextSwitchTo(LogicalRepRelMapContext);
187180
entry->remoterel.remoteid=remoterel->remoteid;
@@ -197,8 +190,6 @@ logicalrep_relmap_update(LogicalRepRelation *remoterel)
197190
}
198191
entry->remoterel.replident=remoterel->replident;
199192
entry->remoterel.attkeys=bms_copy(remoterel->attkeys);
200-
entry->attrmap=NULL;
201-
entry->localreloid=InvalidOid;
202193
MemoryContextSwitchTo(oldctx);
203194
}
204195

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp