Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98eab30

Browse files
Show specific OID suggestion in unused_oids output.
Commita641707 established a new project policy around OID assignment:new patches are encouraged to choose a random OID in the 8000..9999range when a manually-assigned OID is required (if multiple OIDs arerequired, a consecutive block of OIDs starting from the random pointshould be used). Catalog entries added by committed patches that useOIDs from this "unstable" range are renumbered after feature freeze.This practice minimizes OID collisions among concurrently-developedpatches.Show a specific random OID suggestion when the unused_oids script isrun. This makes it easy for patch authors to use a random OID from theunstable range, per the new policy.Author: Julien Rouhaud, Peter GeogheganReviewed-By: Tom LaneDiscussion:https://postgr.es/m/CAH2-WzkkRs2ScmuBQ7xWi7xzp7fC1B3w0Nt8X+n4rBw5k+Z=zA@mail.gmail.com
1 parent4766dce commit98eab30

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

‎src/include/catalog/unused_oids

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ my $FirstGenbkiObjectId =
3838
push @{$oids},$FirstGenbkiObjectId;
3939

4040
my$prev_oid = 0;
41-
foreachmy$oid (sort {$a<=>$b } @{$oids})
41+
my@sortedoids =sort {$a<=>$b } @{$oids};
42+
foreachmy$oid (@sortedoids)
4243
{
4344
if ($oid >$prev_oid + 1)
4445
{
@@ -53,3 +54,25 @@ foreach my $oid (sort { $a <=> $b } @{$oids})
5354
}
5455
$prev_oid =$oid;
5556
}
57+
58+
my$suggestion;
59+
do
60+
{
61+
$suggestion =int(8000 +rand(2000));
62+
}while (grep(/^$suggestion$/, @{$oids}));
63+
64+
my$navailable = 0;
65+
foreachmy$oid (@sortedoids)
66+
{
67+
if ($oid >$suggestion)
68+
{
69+
$navailable =$oid -$suggestion;
70+
last;
71+
}
72+
}
73+
74+
printf"Patches should use a more-or-less consecutive range of OIDs.\n";
75+
printf
76+
"Best practice is to start with a random choice in the range 8000-9999.\n";
77+
printf
78+
"Suggested random unused OID:$suggestion ($navailable consecutive OID(s) available starting here)\n";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp