Ensure preassigned Oids aren't reused during upgrade
During an upgrade, there are numerous new objects created in the new
cluster which either doesn't have an Oids preallocated from the old,
or which never existed in the old cluster to begin with. These objects
are assigned Oids in the new cluster which may collide with Oids which
are preassigned from the old cluster, but which hasn't yet been used
in the restore process. This is because the restore process is doing
the preallocation just before the object creation.
To avoid collisions, the Oids which will be preassigned are tracked
during schema dump, and are injected into the Oid dispatch machinery
before any object is restored such that the list can be queried. This
requires a new mode of dumping in pg_dump where an object is recorded
first in the dependency chain but is dumped last. To support this, a
new API for amending ArchiveEntry objects has been added. Currently
it only supports changing the definition but it can easily be extended
to cover future usecases.
The performance of this patch is a TODO, passing all the Oids in an
array in a single call is unlikely to scale to real-world scenarios
but it's better to subject this to a wider audience sooner rather
than later.
Also fix up since-long outdated documentation comments in oid_dispatch.c
and some minor style nits while in there.
Reviewed-by: NJacob Champion <pchampion@pivotal.io>
Showing
想要评论请 注册 或 登录