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>
|
||||
<listitem>
|
||||
<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
|
||||
names, and exit.
|
||||
</para>
|
||||
|
@ -49,7 +49,8 @@ typedef struct XLogDumpConfig
|
||||
bool stats_per_record;
|
||||
|
||||
/* filter options */
|
||||
int filter_by_rmgr;
|
||||
bool filter_by_rmgr[RM_MAX_ID + 1];
|
||||
bool filter_by_rmgr_enabled;
|
||||
TransactionId filter_by_xid;
|
||||
bool filter_by_xid_enabled;
|
||||
} XLogDumpConfig;
|
||||
@ -825,7 +826,8 @@ main(int argc, char **argv)
|
||||
config.stop_after_records = -1;
|
||||
config.already_displayed_records = 0;
|
||||
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_enabled = false;
|
||||
config.stats = false;
|
||||
@ -884,12 +886,12 @@ main(int argc, char **argv)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.filter_by_rmgr == -1)
|
||||
if (i > RM_MAX_ID)
|
||||
{
|
||||
pg_log_error("resource manager \"%s\" does not exist",
|
||||
optarg);
|
||||
@ -1098,8 +1100,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* apply all specified filters */
|
||||
if (config.filter_by_rmgr != -1 &&
|
||||
config.filter_by_rmgr != record->xl_rmid)
|
||||
if (config.filter_by_rmgr_enabled &&
|
||||
!config.filter_by_rmgr[record->xl_rmid])
|
||||
continue;
|
||||
|
||||
if (config.filter_by_xid_enabled &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user