Skip to content

Commit

Permalink
Minor style fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Chang <[email protected]>
  • Loading branch information
timchang514 committed Jan 8, 2024
1 parent 7bc64f9 commit ef4ef00
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 27 deletions.
4 changes: 1 addition & 3 deletions src/backend/access/transam/varsup.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
/* Number of OIDs to prefetch (preallocate) per XLOG write */
#define VAR_OID_PREFETCH 8192

#define OID_TO_BUFFER_START(oid) ((oid) + INT_MIN)
#define BUFFER_START_TO_OID ((Oid) (temp_oid_buffer_start) - INT_MIN)

/* pointer to "variable cache" in shared memory (set up by shmem.c) */
VariableCache ShmemVariableCache = NULL;

Expand Down Expand Up @@ -520,6 +517,7 @@ ForceTransactionIdLimitUpdate(void)
return false;
}


/*
* GetNewObjectId -- allocate a new OID
*
Expand Down
16 changes: 2 additions & 14 deletions src/backend/catalog/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,29 +565,21 @@ GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
/* Generate the OID */
if (pg_class)
{
/* Temp tables use temp OID logic */
if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && GetNewTempOidWithIndex_hook && temp_oid_buffer_size > 0)
{
/* Temp tables use temp OID logic */
rnode.node.relNode = GetNewTempOidWithIndex_hook(pg_class, ClassOidIndexId,
Anum_pg_class_oid);
}
else
{
rnode.node.relNode = GetNewOidWithIndex(pg_class, ClassOidIndexId,
Anum_pg_class_oid);
}
}
else
{
/* Temp tables use temp OID logic */
if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && GetNewTempObjectId_hook && temp_oid_buffer_size > 0)
{
/* Temp tables use temp OID logic */
rnode.node.relNode = GetNewTempObjectId_hook();
}
else
{
rnode.node.relNode = GetNewObjectId();
}
}

/* Check for existing file of same name */
Expand All @@ -611,15 +603,11 @@ GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
}

if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && tries > temp_oid_buffer_size)
{
ereport(ERROR,
(errmsg("Unable to allocate oid for temp table. Drop some temporary tables or start a new session.")));
}
else if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && tries >= (0.8 * temp_oid_buffer_size))
{
ereport(WARNING,
(errmsg("Temp object OID usage is over 80%%. Consider dropping some temp tables or starting a new session.")));
}

pfree(rpath);
tries++;
Expand Down
6 changes: 1 addition & 5 deletions src/backend/catalog/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,16 +950,12 @@ index_create(Relation heapRelation,
}
else
{
/* Index OIDs must be kept in normal OID range. */
if (is_enr && GetNewPermanentRelFileNode_hook)
{
/* Index OIDs must be kept in normal OID range. */
indexRelationId = GetNewPermanentRelFileNode_hook(tableSpaceId, pg_class, relpersistence);
}
else
{
indexRelationId =
GetNewRelFileNode(tableSpaceId, pg_class, relpersistence);
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/backend/catalog/toasting.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,9 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
* Create the toast table and its index
*/
if (sql_dialect == SQL_DIALECT_TSQL && RelationIsBBFTableVariable(rel))
{
pg_toast_prefix = "@pg_toast";
}
else if (sql_dialect == SQL_DIALECT_TSQL && rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP && get_ENR_withoid(currentQueryEnv, rel->rd_id, ENR_TSQL_TEMP))
{
pg_toast_prefix = "#pg_toast";
}

snprintf(toast_relname, sizeof(toast_relname),
"%s_%u", pg_toast_prefix, relOid);
Expand Down
1 change: 0 additions & 1 deletion src/include/utils/rel.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,3 @@ extern void RelationDecrementReferenceCount(Relation rel);
(relation)->rd_rel->relname.data[0] == '@')

#endif /* REL_H */

0 comments on commit ef4ef00

Please sign in to comment.