summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-03-12 10:50:48 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-03-12 10:50:48 -0400
commita6417078c4140e51cfd717448430f274b449d687 (patch)
tree386b8fc28becaefb8bfd60cf369c95684c5fada4 /doc/src
parentb5afdde6a7bb777d399b20da6fb8a664a1cd2784 (diff)
Create a script that can renumber manually-assigned OIDs.
This commit adds a Perl script renumber_oids.pl, which can reassign a range of manually-assigned OIDs to someplace else by modifying OID fields of the catalog *.dat files and OID-assigning macros in the catalog *.h files. Up to now, we've encouraged new patches that need manually-assigned OIDs to use OIDs just above the range of existing OIDs. Predictably, this leads to patches stepping on each others' toes, as whichever one gets committed first creates an OID conflict that other patch author(s) have to resolve manually. With the availability of renumber_oids.pl, we can eliminate a lot of this hassle. The new project policy, therefore, is: * Encourage new patches to use high OIDs (the documentation suggests choosing a block of OIDs at random in 8000..9999). * After feature freeze in each development cycle, run renumber_oids.pl to move all such OIDs down to lower numbers, thus freeing the high OID range for the next development cycle. This plan should greatly reduce the risk of OID collisions between concurrently-developed patches. Also, if such a collision happens anyway, we have the option to resolve it without much effort by doing an off-schedule OID renumbering to get the first-committed patch out of the way. Or a patch author could use renumber_oids.pl to change their patch's assignments without much pain. This approach does put a premium on not hard-wiring any OID values in places where renumber_oids.pl and genbki.pl can't fix them. Project practice in that respect seems to be pretty good already, but a follow-on patch will sand down some rough edges. John Naylor and Tom Lane, per an idea of Peter Geoghegan's Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/bki.sgml40
1 files changed, 37 insertions, 3 deletions
diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml
index 3c5830bc8ad..5f80f9ed24d 100644
--- a/doc/src/sgml/bki.sgml
+++ b/doc/src/sgml/bki.sgml
@@ -388,15 +388,49 @@
to see which ones do not appear. You can also use
the <filename>duplicate_oids</filename> script to check for mistakes.
(<filename>genbki.pl</filename> will assign OIDs for any rows that
- didn't get one hand-assigned to them and also detect duplicate OIDs
- at compile time.)
+ didn't get one hand-assigned to them, and it will also detect duplicate
+ OIDs at compile time.)
+ </para>
+
+ <para>
+ When choosing OIDs for a patch that is not expected to be committed
+ immediately, best practice is to use a group of more-or-less
+ consecutive OIDs starting with some random choice in the range
+ 8000&mdash;9999. This minimizes the risk of OID collisions with other
+ patches being developed concurrently. To keep the 8000&mdash;9999
+ range free for development purposes, after a patch has been committed
+ to the master git repository its OIDs should be renumbered into
+ available space below that range. Typically, this will be done
+ near the end of each development cycle, moving all OIDs consumed by
+ patches committed in that cycle at the same time. The script
+ <filename>renumber_oids.pl</filename> can be used for this purpose.
+ If an uncommitted patch is found to have OID conflicts with some
+ recently-committed patch, <filename>renumber_oids.pl</filename> may
+ also be useful for recovering from that situation.
+ </para>
+
+ <para>
+ Because of this convention of possibly renumbering OIDs assigned by
+ patches, the OIDs assigned by a patch should not be considered stable
+ until the patch has been included in an official release. We do not
+ change manually-assigned object OIDs once released, however, as that
+ would create assorted compatibility problems.
</para>
<para>
The OID counter starts at 10000 at the beginning of a bootstrap run.
If a row from a source other than <filename>postgres.bki</filename>
is inserted into a table that requires OIDs, then it will receive an
- OID of 10000 or above.
+ OID of 10000 or above. For example, objects created while running
+ the <filename>information_schema.sql</filename> script receive such
+ OIDs.
+ </para>
+
+ <para>
+ OIDs assigned during normal database operation are constrained to be
+ 16384 or higher. This leaves the range 10000&mdash;16383 available
+ for OIDs assigned automatically during bootstrap. These OIDs are not
+ considered stable, and may change from one installation to another.
</para>
</sect2>