Fix inappropriate comments in function ReplicationSlotAcquire

Wei Wang (Fujitsu) <wangw.fnst@fujitsu.com>

From: "Wei Wang (Fujitsu)" <wangw.fnst@fujitsu.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-01-25T09:26:42Z
Lists: pgsql-hackers

Attachments

Hi,

In the function ReplicationSlotAcquire(), I found there is a missing in the
below comments:

```
	/*
	 * Search for the slot with the specified name if the slot to acquire is
	 * not given. If the slot is not found, we either return -1 or error out.
	 */
	s = SearchNamedReplicationSlot(name, false);
	if (s == NULL || !s->in_use)
	{
		LWLockRelease(ReplicationSlotControlLock);

		ereport(ERROR,
				(errcode(ERRCODE_UNDEFINED_OBJECT),
				 errmsg("replication slot \"%s\" does not exist",
						name)));
	}
```

It seems that when the slot is not found, we will only error out and will not
return -1. Attach the patch to remove the inappropriate description of return
value.

Regards,
Wang Wei

Commits

  1. Fix comments in ReplicationSlotAcquire().

  2. Return ReplicationSlotAcquire API to its original form