Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e3679bc

Browse files
committed
pg_resetwal: Corrections around -c option
The present pg_resetwal code hardcodes the minimum value for -c as 2, which is FrozenTransactionId, but it's not clear why that is allowed. After some research, it was probably a mistake in the original patch. Change it to FirstNormalTransactionId, which matches other xid-related options in pg_resetwal. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://www.postgresql.org/message-id/flat/d09f0e91-8757-642b-1a92-da9a52f5589a%40eisentraut.org
1 parent 1d91d24 commit e3679bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bin/pg_resetwal/pg_resetwal.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ main(int argc, char *argv[])
211211
exit(1);
212212
}
213213

214-
if (set_oldest_commit_ts_xid < 2 &&
215-
set_oldest_commit_ts_xid != 0)
216-
pg_fatal("transaction ID (-c) must be either 0 or greater than or equal to 2");
214+
if (set_oldest_commit_ts_xid < FirstNormalTransactionId &&
215+
set_oldest_commit_ts_xid != InvalidTransactionId)
216+
pg_fatal("transaction ID (-c) must be either %u or greater than or equal to %u", InvalidTransactionId, FirstNormalTransactionId);
217217

218-
if (set_newest_commit_ts_xid < 2 &&
219-
set_newest_commit_ts_xid != 0)
220-
pg_fatal("transaction ID (-c) must be either 0 or greater than or equal to 2");
218+
if (set_newest_commit_ts_xid < FirstNormalTransactionId &&
219+
set_newest_commit_ts_xid != InvalidTransactionId)
220+
pg_fatal("transaction ID (-c) must be either %u or greater than or equal to %u", InvalidTransactionId, FirstNormalTransactionId);
221221
break;
222222

223223
case 'o':

0 commit comments

Comments
 (0)