mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Allow specifying pg_waldump --rmgr option multiple times.
Before, if you specified multiple --rmgr options, only the last one took effect. It seems more sensible to select all the specified resource managers. Reviewed-By: Daniel Gustafsson, Julien Rouhaud Discussion: https://www.postgresql.org/message-id/98344bc2-e222-02ad-a75b-81ffc614c155%40iki.fi
This commit is contained in:
parent
71ba45a360
commit
c8bf5098cb
@ -142,7 +142,8 @@ PostgreSQL documentation
|
|||||||
<term><option>--rmgr=<replaceable>rmgr</replaceable></option></term>
|
<term><option>--rmgr=<replaceable>rmgr</replaceable></option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Only display records generated by the specified resource manager.
|
Only display records generated by the specified resource manager. You can
|
||||||
|
specify the option multiple times to select multiple resource managers.
|
||||||
If <literal>list</literal> is passed as name, print a list of valid resource manager
|
If <literal>list</literal> is passed as name, print a list of valid resource manager
|
||||||
names, and exit.
|
names, and exit.
|
||||||
</para>
|
</para>
|
||||||
|
@ -49,7 +49,8 @@ typedef struct XLogDumpConfig
|
|||||||
bool stats_per_record;
|
bool stats_per_record;
|
||||||
|
|
||||||
/* filter options */
|
/* filter options */
|
||||||
int filter_by_rmgr;
|
bool filter_by_rmgr[RM_MAX_ID + 1];
|
||||||
|
bool filter_by_rmgr_enabled;
|
||||||
TransactionId filter_by_xid;
|
TransactionId filter_by_xid;
|
||||||
bool filter_by_xid_enabled;
|
bool filter_by_xid_enabled;
|
||||||
} XLogDumpConfig;
|
} XLogDumpConfig;
|
||||||
@ -825,7 +826,8 @@ main(int argc, char **argv)
|
|||||||
config.stop_after_records = -1;
|
config.stop_after_records = -1;
|
||||||
config.already_displayed_records = 0;
|
config.already_displayed_records = 0;
|
||||||
config.follow = false;
|
config.follow = false;
|
||||||
config.filter_by_rmgr = -1;
|
/* filter_by_rmgr array was zeroed by memset above */
|
||||||
|
config.filter_by_rmgr_enabled = false;
|
||||||
config.filter_by_xid = InvalidTransactionId;
|
config.filter_by_xid = InvalidTransactionId;
|
||||||
config.filter_by_xid_enabled = false;
|
config.filter_by_xid_enabled = false;
|
||||||
config.stats = false;
|
config.stats = false;
|
||||||
@ -884,12 +886,12 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (pg_strcasecmp(optarg, RmgrDescTable[i].rm_name) == 0)
|
if (pg_strcasecmp(optarg, RmgrDescTable[i].rm_name) == 0)
|
||||||
{
|
{
|
||||||
config.filter_by_rmgr = i;
|
config.filter_by_rmgr[i] = true;
|
||||||
|
config.filter_by_rmgr_enabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i > RM_MAX_ID)
|
||||||
if (config.filter_by_rmgr == -1)
|
|
||||||
{
|
{
|
||||||
pg_log_error("resource manager \"%s\" does not exist",
|
pg_log_error("resource manager \"%s\" does not exist",
|
||||||
optarg);
|
optarg);
|
||||||
@ -1098,8 +1100,8 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* apply all specified filters */
|
/* apply all specified filters */
|
||||||
if (config.filter_by_rmgr != -1 &&
|
if (config.filter_by_rmgr_enabled &&
|
||||||
config.filter_by_rmgr != record->xl_rmid)
|
!config.filter_by_rmgr[record->xl_rmid])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (config.filter_by_xid_enabled &&
|
if (config.filter_by_xid_enabled &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user