mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Extend near-wraparound hints to include replication slots
Author: Feike Steenbergen Reviewed-by: Michael Paquier
This commit is contained in:
@ -248,16 +248,18 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
|
|||||||
may consume changes from a slot at any given time.
|
may consume changes from a slot at any given time.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note>
|
<caution>
|
||||||
<para>
|
<para>
|
||||||
Replication slots persist across crashes and know nothing about the state
|
Replication slots persist across crashes and know nothing about the state
|
||||||
of their consumer(s). They will prevent removal of required resources
|
of their consumer(s). They will prevent removal of required resources
|
||||||
even when there is no connection using them. This consumes storage
|
even when there is no connection using them. This consumes storage
|
||||||
because neither required WAL nor required rows from the system catalogs
|
because neither required WAL nor required rows from the system catalogs
|
||||||
can be removed by <command>VACUUM</command> as long as they are required by a replication
|
can be removed by <command>VACUUM</command> as long as they are required by a replication
|
||||||
slot. So if a slot is no longer required it should be dropped.
|
slot. In extreme cases this could cause the database to shut down to prevent
|
||||||
|
transaction ID wraparound (see <xref linkend="vacuum-for-wraparound"/>).
|
||||||
|
So if a slot is no longer required it should be dropped.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</caution>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
|
@ -1000,14 +1000,14 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
|
|||||||
errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database \"%s\"",
|
errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database \"%s\"",
|
||||||
oldest_datname),
|
oldest_datname),
|
||||||
errhint("Execute a database-wide VACUUM in that database.\n"
|
errhint("Execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||||
errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database with OID %u",
|
errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database with OID %u",
|
||||||
oldest_datoid),
|
oldest_datoid),
|
||||||
errhint("Execute a database-wide VACUUM in that database.\n"
|
errhint("Execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1031,7 +1031,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
|
|||||||
oldest_datname,
|
oldest_datname,
|
||||||
multiWrapLimit - result),
|
multiWrapLimit - result),
|
||||||
errhint("Execute a database-wide VACUUM in that database.\n"
|
errhint("Execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
|
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
|
||||||
@ -1040,7 +1040,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
|
|||||||
oldest_datoid,
|
oldest_datoid,
|
||||||
multiWrapLimit - result),
|
multiWrapLimit - result),
|
||||||
errhint("Execute a database-wide VACUUM in that database.\n"
|
errhint("Execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-acquire lock and start over */
|
/* Re-acquire lock and start over */
|
||||||
@ -2321,7 +2321,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid,
|
|||||||
oldest_datname,
|
oldest_datname,
|
||||||
multiWrapLimit - curMulti),
|
multiWrapLimit - curMulti),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
|
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
|
||||||
@ -2330,7 +2330,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid,
|
|||||||
oldest_datoid,
|
oldest_datoid,
|
||||||
multiWrapLimit - curMulti),
|
multiWrapLimit - curMulti),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,14 +124,14 @@ GetNewTransactionId(bool isSubXact)
|
|||||||
errmsg("database is not accepting commands to avoid wraparound data loss in database \"%s\"",
|
errmsg("database is not accepting commands to avoid wraparound data loss in database \"%s\"",
|
||||||
oldest_datname),
|
oldest_datname),
|
||||||
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
|
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||||
errmsg("database is not accepting commands to avoid wraparound data loss in database with OID %u",
|
errmsg("database is not accepting commands to avoid wraparound data loss in database with OID %u",
|
||||||
oldest_datoid),
|
oldest_datoid),
|
||||||
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
|
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
else if (TransactionIdFollowsOrEquals(xid, xidWarnLimit))
|
else if (TransactionIdFollowsOrEquals(xid, xidWarnLimit))
|
||||||
{
|
{
|
||||||
@ -144,14 +144,14 @@ GetNewTransactionId(bool isSubXact)
|
|||||||
oldest_datname,
|
oldest_datname,
|
||||||
xidWrapLimit - xid),
|
xidWrapLimit - xid),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg("database with OID %u must be vacuumed within %u transactions",
|
(errmsg("database with OID %u must be vacuumed within %u transactions",
|
||||||
oldest_datoid,
|
oldest_datoid,
|
||||||
xidWrapLimit - xid),
|
xidWrapLimit - xid),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-acquire lock and start over */
|
/* Re-acquire lock and start over */
|
||||||
@ -403,14 +403,14 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid)
|
|||||||
oldest_datname,
|
oldest_datname,
|
||||||
xidWrapLimit - curXid),
|
xidWrapLimit - curXid),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
else
|
else
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg("database with OID %u must be vacuumed within %u transactions",
|
(errmsg("database with OID %u must be vacuumed within %u transactions",
|
||||||
oldest_datoid,
|
oldest_datoid,
|
||||||
xidWrapLimit - curXid),
|
xidWrapLimit - curXid),
|
||||||
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
|
||||||
"You might also need to commit or roll back old prepared transactions.")));
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +655,8 @@ vacuum_set_xid_limits(Relation rel,
|
|||||||
{
|
{
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg("oldest xmin is far in the past"),
|
(errmsg("oldest xmin is far in the past"),
|
||||||
errhint("Close open transactions soon to avoid wraparound problems.")));
|
errhint("Close open transactions soon to avoid wraparound problems.\n"
|
||||||
|
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
|
||||||
limit = *oldestXmin;
|
limit = *oldestXmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user