mirror of
https://github.com/postgres/postgres.git
synced 2025-05-13 01:13:08 -04:00
Remove redundant setting of hashkey after insertion
It's not necessary to fill the key field in most cases, since hash_search has already done that. Some existing call sites have an assert or comment that this contract has been fulfilled, but those are quite old and that practice seems unnecessary here. While at it, remove a nearby redundant assignment that a smart compiler will elide anyway. Zhao Junwang, with some adjustments by me Reviewed by Nathan Bossart, with additional feedback from Tom Lane Discussion: http://postgr.es/m/CAEG8a3%2BUPF%3DR2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA%40mail.gmail.com
This commit is contained in:
parent
489ca33081
commit
095d109ccd
@ -2574,7 +2574,6 @@ createNewConnection(const char *name, remoteConn *rconn)
|
||||
}
|
||||
|
||||
hentry->rconn = rconn;
|
||||
strlcpy(hentry->name, name, sizeof(hentry->name));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2305,15 +2305,13 @@ AddEventToPendingNotifies(Notification *n)
|
||||
foreach(l, pendingNotifies->events)
|
||||
{
|
||||
Notification *oldn = (Notification *) lfirst(l);
|
||||
NotificationHash *hentry;
|
||||
bool found;
|
||||
|
||||
hentry = (NotificationHash *) hash_search(pendingNotifies->hashtab,
|
||||
(void) hash_search(pendingNotifies->hashtab,
|
||||
&oldn,
|
||||
HASH_ENTER,
|
||||
&found);
|
||||
Assert(!found);
|
||||
hentry->event = oldn;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2323,15 +2321,13 @@ AddEventToPendingNotifies(Notification *n)
|
||||
/* Add event to the hash table if needed */
|
||||
if (pendingNotifies->hashtab != NULL)
|
||||
{
|
||||
NotificationHash *hentry;
|
||||
bool found;
|
||||
|
||||
hentry = (NotificationHash *) hash_search(pendingNotifies->hashtab,
|
||||
(void) hash_search(pendingNotifies->hashtab,
|
||||
&n,
|
||||
HASH_ENTER,
|
||||
&found);
|
||||
Assert(!found);
|
||||
hentry->event = n;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2104,10 +2104,7 @@ ExecuteTruncateGuts(List *explicit_rels,
|
||||
/* Find or create cached entry for the foreign table */
|
||||
ft_info = hash_search(ft_htab, &serverid, HASH_ENTER, &found);
|
||||
if (!found)
|
||||
{
|
||||
ft_info->serverid = serverid;
|
||||
ft_info->rels = NIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the foreign table in the entry of the server that the
|
||||
|
@ -509,7 +509,6 @@ pa_allocate_worker(TransactionId xid)
|
||||
winfo->in_use = true;
|
||||
winfo->serialize_changes = false;
|
||||
entry->winfo = winfo;
|
||||
entry->xid = xid;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -657,7 +657,6 @@ logicalrep_partition_open(LogicalRepRelMapEntry *root,
|
||||
int i;
|
||||
|
||||
/* Remote relation is copied as-is from the root entry. */
|
||||
entry = &part_entry->relmapentry;
|
||||
entry->remoterel.remoteid = remoterel->remoteid;
|
||||
entry->remoterel.nspname = pstrdup(remoterel->nspname);
|
||||
entry->remoterel.relname = pstrdup(remoterel->relname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user