blocklist.patch
text/x-patch
Filename: blocklist.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/transam/parallel.c | 14 | 14 |
| src/backend/catalog/pg_enum.c | 28 | 28 |
| src/backend/utils/adt/enum.c | 2 | 2 |
| src/include/catalog/pg_enum.h | 4 | 4 |
| src/tools/pgindent/pgindent | 4 | 4 |
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 14a8690019..6f93b41e4f 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -75,7 +75,7 @@
#define PARALLEL_KEY_PENDING_SYNCS UINT64CONST(0xFFFFFFFFFFFF000B)
#define PARALLEL_KEY_REINDEX_STATE UINT64CONST(0xFFFFFFFFFFFF000C)
#define PARALLEL_KEY_RELMAPPER_STATE UINT64CONST(0xFFFFFFFFFFFF000D)
-#define PARALLEL_KEY_ENUMBLACKLIST UINT64CONST(0xFFFFFFFFFFFF000E)
+#define PARALLEL_KEY_ENUMBLOCKLIST UINT64CONST(0xFFFFFFFFFFFF000E)
/* Fixed-size parallel state. */
typedef struct FixedParallelState
@@ -211,7 +211,7 @@ InitializeParallelDSM(ParallelContext *pcxt)
Size pendingsyncslen = 0;
Size reindexlen = 0;
Size relmapperlen = 0;
- Size enumblacklistlen = 0;
+ Size enumblocklistlen = 0;
Size segsize = 0;
int i;
FixedParallelState *fps;
@@ -267,8 +267,8 @@ InitializeParallelDSM(ParallelContext *pcxt)
shm_toc_estimate_chunk(&pcxt->estimator, reindexlen);
relmapperlen = EstimateRelationMapSpace();
shm_toc_estimate_chunk(&pcxt->estimator, relmapperlen);
- enumblacklistlen = EstimateEnumBlacklistSpace();
- shm_toc_estimate_chunk(&pcxt->estimator, enumblacklistlen);
+ enumblocklistlen = EstimateEnumBlocklistSpace();
+ shm_toc_estimate_chunk(&pcxt->estimator, enumblocklistlen);
/* If you add more chunks here, you probably need to add keys. */
shm_toc_estimate_keys(&pcxt->estimator, 11);
@@ -348,7 +348,7 @@ InitializeParallelDSM(ParallelContext *pcxt)
char *error_queue_space;
char *session_dsm_handle_space;
char *entrypointstate;
- char *enumblacklistspace;
+ char *enumblocklistspace;
Size lnamelen;
/* Serialize shared libraries we have loaded. */
@@ -404,11 +404,11 @@ InitializeParallelDSM(ParallelContext *pcxt)
shm_toc_insert(pcxt->toc, PARALLEL_KEY_RELMAPPER_STATE,
relmapperspace);
- /* Serialize enum blacklist state. */
- enumblacklistspace = shm_toc_allocate(pcxt->toc, enumblacklistlen);
- SerializeEnumBlacklist(enumblacklistspace, enumblacklistlen);
- shm_toc_insert(pcxt->toc, PARALLEL_KEY_ENUMBLACKLIST,
- enumblacklistspace);
+ /* Serialize enum blocklist state. */
+ enumblocklistspace = shm_toc_allocate(pcxt->toc, enumblocklistlen);
+ SerializeEnumBlocklist(enumblocklistspace, enumblocklistlen);
+ shm_toc_insert(pcxt->toc, PARALLEL_KEY_ENUMBLOCKLIST,
+ enumblocklistspace);
/* Allocate space for worker information. */
pcxt->worker = palloc0(sizeof(ParallelWorkerInfo) * pcxt->nworkers);
@@ -1257,7 +1257,7 @@ ParallelWorkerMain(Datum main_arg)
char *pendingsyncsspace;
char *reindexspace;
char *relmapperspace;
- char *enumblacklistspace;
+ char *enumblocklistspace;
StringInfoData msgbuf;
char *session_dsm_handle_space;
@@ -1449,10 +1449,10 @@ ParallelWorkerMain(Datum main_arg)
relmapperspace = shm_toc_lookup(toc, PARALLEL_KEY_RELMAPPER_STATE, false);
RestoreRelationMap(relmapperspace);
- /* Restore enum blacklist. */
- enumblacklistspace = shm_toc_lookup(toc, PARALLEL_KEY_ENUMBLACKLIST,
+ /* Restore enum blocklist. */
+ enumblocklistspace = shm_toc_lookup(toc, PARALLEL_KEY_ENUMBLOCKLIST,
false);
- RestoreEnumBlacklist(enumblacklistspace);
+ RestoreEnumBlocklist(enumblocklistspace);
/* Attach to the leader's serializable transaction, if SERIALIZABLE. */
AttachSerializableXact(fps->serializable_xact_handle);
diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index 27e4100a6f..0221313433 100644
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -41,10 +41,10 @@ Oid binary_upgrade_next_pg_enum_oid = InvalidOid;
* committed; otherwise, they might get into indexes where we can't clean
* them up, and then if the transaction rolls back we have a broken index.
* (See comments for check_safe_enum_use() in enum.c.) Values created by
- * EnumValuesCreate are *not* blacklisted; we assume those are created during
+ * EnumValuesCreate are *not* blocklisted; we assume those are created during
* CREATE TYPE, so they can't go away unless the enum type itself does.
*/
-static HTAB *enum_blacklist = NULL;
+static HTAB *enum_blocklist = NULL;
static void RenumberEnumType(Relation pg_enum, HeapTuple *existing, int nelems);
static int sort_order_cmp(const void *p1, const void *p2);
@@ -181,10 +181,10 @@ EnumValuesDelete(Oid enumTypeOid)
}
/*
- * Initialize the enum blacklist for this transaction.
+ * Initialize the enum blocklist for this transaction.
*/
static void
-init_enum_blacklist(void)
+init_enum_blocklist(void)
{
HASHCTL hash_ctl;
@@ -192,7 +192,7 @@ init_enum_blacklist(void)
hash_ctl.keysize = sizeof(Oid);
hash_ctl.entrysize = sizeof(Oid);
hash_ctl.hcxt = TopTransactionContext;
- enum_blacklist = hash_create("Enum value blacklist",
+ enum_blocklist = hash_create("Enum value blocklist",
32,
&hash_ctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
@@ -491,12 +491,12 @@ restart:
table_close(pg_enum, RowExclusiveLock);
- /* Set up the blacklist hash if not already done in this transaction */
- if (enum_blacklist == NULL)
- init_enum_blacklist();
+ /* Set up the blocklist hash if not already done in this transaction */
+ if (enum_blocklist == NULL)
+ init_enum_blocklist();
- /* Add the new value to the blacklist */
- (void) hash_search(enum_blacklist, &newOid, HASH_ENTER, NULL);
+ /* Add the new value to the blocklist */
+ (void) hash_search(enum_blocklist, &newOid, HASH_ENTER, NULL);
}
@@ -585,19 +585,19 @@ RenameEnumLabel(Oid enumTypeOid,
/*
- * Test if the given enum value is on the blacklist
+ * Test if the given enum value is on the blocklist
*/
bool
-EnumBlacklisted(Oid enum_id)
+EnumBlocklisted(Oid enum_id)
{
bool found;
- /* If we've made no blacklist table, all values are safe */
- if (enum_blacklist == NULL)
+ /* If we've made no blocklist table, all values are safe */
+ if (enum_blocklist == NULL)
return false;
/* Else, is it in the table? */
- (void) hash_search(enum_blacklist, &enum_id, HASH_FIND, &found);
+ (void) hash_search(enum_blocklist, &enum_id, HASH_FIND, &found);
return found;
}
@@ -609,11 +609,11 @@ void
AtEOXact_Enum(void)
{
/*
- * Reset the blacklist table, as all our enum values are now committed.
+ * Reset the blocklist table, as all our enum values are now committed.
* The memory will go away automatically when TopTransactionContext is
* freed; it's sufficient to clear our pointer.
*/
- enum_blacklist = NULL;
+ enum_blocklist = NULL;
}
@@ -692,12 +692,12 @@ sort_order_cmp(const void *p1, const void *p2)
}
Size
-EstimateEnumBlacklistSpace(void)
+EstimateEnumBlocklistSpace(void)
{
size_t entries;
- if (enum_blacklist)
- entries = hash_get_num_entries(enum_blacklist);
+ if (enum_blocklist)
+ entries = hash_get_num_entries(enum_blocklist);
else
entries = 0;
@@ -706,7 +706,7 @@ EstimateEnumBlacklistSpace(void)
}
void
-SerializeEnumBlacklist(void *space, Size size)
+SerializeEnumBlocklist(void *space, Size size)
{
Oid *serialized = (Oid *) space;
@@ -714,15 +714,15 @@ SerializeEnumBlacklist(void *space, Size size)
* Make sure the hash table hasn't changed in size since the caller
* reserved the space.
*/
- Assert(size == EstimateEnumBlacklistSpace());
+ Assert(size == EstimateEnumBlocklistSpace());
/* Write out all the values from the hash table, if there is one. */
- if (enum_blacklist)
+ if (enum_blocklist)
{
HASH_SEQ_STATUS status;
Oid *value;
- hash_seq_init(&status, enum_blacklist);
+ hash_seq_init(&status, enum_blocklist);
while ((value = (Oid *) hash_seq_search(&status)))
*serialized++ = *value;
}
@@ -738,11 +738,11 @@ SerializeEnumBlacklist(void *space, Size size)
}
void
-RestoreEnumBlacklist(void *space)
+RestoreEnumBlocklist(void *space)
{
Oid *serialized = (Oid *) space;
- Assert(!enum_blacklist);
+ Assert(!enum_blocklist);
/*
* As a special case, if the list is empty then don't even bother to
@@ -753,9 +753,9 @@ RestoreEnumBlacklist(void *space)
return;
/* Read all the values into a new hash table. */
- init_enum_blacklist();
+ init_enum_blocklist();
do
{
- hash_search(enum_blacklist, serialized++, HASH_ENTER, NULL);
+ hash_search(enum_blocklist, serialized++, HASH_ENTER, NULL);
} while (OidIsValid(*serialized));
}
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c
index 5ead794e34..ac78ca853f 100644
--- a/src/backend/utils/adt/enum.c
+++ b/src/backend/utils/adt/enum.c
@@ -83,12 +83,12 @@ check_safe_enum_use(HeapTuple enumval_tup)
return;
/*
- * Check if the enum value is blacklisted. If not, it's safe, because it
+ * Check if the enum value is blocklisted. If not, it's safe, because it
* was made during CREATE TYPE AS ENUM and can't be shorter-lived than its
* owning type. (This'd also be false for values made by other
* transactions; but the previous tests should have handled all of those.)
*/
- if (!EnumBlacklisted(en->oid))
+ if (!EnumBlocklisted(en->oid))
return;
/*
diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h
index b28d441ba7..fcf9bc537c 100644
--- a/src/include/catalog/pg_enum.h
+++ b/src/include/catalog/pg_enum.h
@@ -53,10 +53,10 @@ extern void AddEnumLabel(Oid enumTypeOid, const char *newVal,
bool skipIfExists);
extern void RenameEnumLabel(Oid enumTypeOid,
const char *oldVal, const char *newVal);
-extern bool EnumBlacklisted(Oid enum_id);
-extern Size EstimateEnumBlacklistSpace(void);
-extern void SerializeEnumBlacklist(void *space, Size size);
-extern void RestoreEnumBlacklist(void *space);
+extern bool EnumBlocklisted(Oid enum_id);
+extern Size EstimateEnumBlocklistSpace(void);
+extern void SerializeEnumBlocklist(void *space, Size size);
+extern void RestoreEnumBlocklist(void *space);
extern void AtEOXact_Enum(void);
#endif /* PG_ENUM_H */
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 457e328824..67582048b9 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -55,11 +55,11 @@ $excludes ||= "$code_base/src/tools/pgindent/exclude_file_patterns"
# according to <stdbool.h>), and may include some names we don't want
# treated as typedefs, although various headers that some builds include
# might make them so. For the moment we just hardwire a whitelist of names
-# to add and a blacklist of names to remove; eventually this may need to be
+# to add and a blocklist of names to remove; eventually this may need to be
# easier to configure. Note that the typedefs need trailing newlines.
my @whitelist = ("bool\n");
-my %blacklist = map { +"$_\n" => 1 } qw(
+my %blocklist = map { +"$_\n" => 1 } qw(
ANY FD_SET U abs allocfunc boolean date digit ilist interval iterator other
pointer printfunc reference string timestamp type wrap
);
@@ -137,8 +137,8 @@ sub load_typedefs
# add whitelisted entries
push(@typedefs, @whitelist);
- # remove blacklisted entries
- @typedefs = grep { !$blacklist{$_} } @typedefs;
+ # remove blocklisted entries
+ @typedefs = grep { !$blocklist{$_} } @typedefs;
# write filtered typedefs
my $filter_typedefs_fh = new File::Temp(TEMPLATE => "pgtypedefXXXXX");