[YSQL] Rename YB type/variable/function names with yb prefix
#27,022 opened on 2025年5月1日
Repository metrics
- Stars
- (8,229 stars)
- PR merge metrics
- (平均マージ 17d 21h) (30d で 92 merged PRs)
説明
Jira Link: DB-16495
Description
All YB-introduced types/variables/functions should have "yb" or "ysql" in them. Further, there should be lint rules to prevent such mistakes from happening (this can be done separately as a followup; it may be worth staging this to (1) simple renames, (2) complicated renames, (3) lint rule). One possible way to do that is comparing ctags output between YB's file and PG's file (versioned at the commit specified in src/lint/upstream_repositories.csv), but this might be tricky to enforce for local variables of functions. See src/lint/diff_file_with_upstream.py and usages of it for inspiration.
One of the more involved changes is splitting postgres functions to two pieces, one holding >80% of the original body, and another calling this function as a wrapper on top of it, typically holding the same name as the original postgres function. This approach should be reevaluated: is it really worth it from a merge standpoint? is there a better way to do these?
It would be worthwhile to do this naming cleanup before the next major version PG merge.
When working on c1a4632453751094ada4a39ec26f97c7170d2567, I noted down potential names to add yb prefix for. Fair warning: the notes are not organized and may be illegible:
auto_explain_log_dist
auto_explain.log_dist
NextCopyFrom param skip_row
pg_stat_statements.c prelim_max_value
pg_stat_statements.c derived_max_magnitude
pg_stat_statements.c calc_stddev
pg_stat_statements.c query_buffer_helper
pg_stat_statements.c read_entry_original
pg_stat_statements.c read_entry_hdr
pg_stat_statements.c extended_header_reader
pg_stat_statements.c enforce_bucket_factor
table_index_build_range_scan param bfinfo
table_index_build_range_scan param bfresult
indextuple.c index_size_mask
GetCurrentTransactionName
increment_sticky_object_count
decrement_sticky_object_count
bootparse.y istmt
bootparse.y Boot_DeclarePrimaryIndexStmt
bootparse.y PRIMARY
ExecGrant_Tablegroup
pg_tablegroup_aclcheck
GetBackendOidFromRelPersistence
DoesRelFileExist
DoesOidExistInRelation
IsTableOidUnused
GetTableOidFromRelOptions
GetRowTypeOidFromRelOptions
deleteOneObject's implicit_tablegroup, is_colocated_tables_with_tablespace_enabled
doDeletion's index, rel
heap_create reltablegroup
heap_create_with_catalog reltablegroup, is_system, shared_relation
index_concurrently_create_copy's is_colocated
index_backfill
IndexBackfillHeapRangeScan
CatalogIndexDelete
DEFACLOBJ_TABLEGROUP
OCLASS_TBLGROUP
get_primary_key_attnos's iterator
tablegroupHasDependents
storeObjectDescription's refobjid
recordDependencyOnTablespace
shdepFindImplicitTablegroup
SHARED_DEPENDENCY_PROFILE
TypeCreate's isSystem
RenameFunction
AlterTablegroupOwner
AlterFunctionOwner
CopyFrom's useNonTxnInsert, has_more_tuples, set_txn_batch_size_explicitly, has_rule_or_trigger
NextCopyFrom's skip_row
DoCopyTo's oldcontext
createdb's yb vars, is_clone, retry_on_oid_collision
AlterDatabase's unsupported_options
explain.c CEILING_K, BUILD_STAT_LABEL_DATA, BUILD_REQUEST_STAT_LABEL_DATA, etc
ExplainOnePlan show_variable_fields, peakMem
show_sort_info show_variable_fields
show_hash_info show_variable_fields
AlterFunctionOwner
AlterFunctionOwner_internal
RenameFunction
DefineIndex's yb variables
ComputeIndexAttrs's is_colocated, tablegroupId, range_index
RelationBuildRowSecurity's iter
AlterSequence's seq_data, last_val, is_called
init_params's cacheOptionOrLastCache, cacheFlag, computedCacheValue
ATRewriteCatalogs's rollbackHandles
ATExecDropColumn's yb_tab positioning
ATExecAddIndex's yb_wqueue positioning
ATExecDropConstraint's yb_wqueue positioning, tab, mutable_rel
DefineRelation's yb variables, tablegroupId, colocation_id
RemoveRelations's only_temp_tables
ATController's rollbackHandles
ATRewriteCatalogs's rollbackHandles, lots of local vars scattered
ATExecCmd's mutable_rel
AlterRelationNamespaceInternal's rel
validatePlacementConfiguration
RelationBuildTriggers's iter
GetCurrentFDWTuplestore's evtshared, trigger_data, is_deferred, ret, lots more
AlterRole's local vars
assign_transaction_read_only
is_staleness_acceptable
check_follower_reads
assign_follower_reads
check_follower_read_staleness_ms
assign_follower_read_staleness_ms
assign_transaction_deferrable
ExecInitExprRec's off, fcinfos, fn_addrs in case T_RowCompareExpr:
EEOP_ROWARRAY_COMPARE
execTuplesHashPrepare's leftHashFunctions, rightHashFunctions
FindTupleHashEntry's keyColIdx
TupleHashTableHash_internal's eval_exprs
ExecDeleteIndexTuples
ExecBuildSlotValueDescription's rel
ExecPartitionCheckEmitError's rel
ExecConstraints's mtstate
ExecConstraints's att_in_modified_cols
ExecBuildSlotValueDescription's rel
ExecInitPartitionInfo's resultRelationIndex
FreeExecutorState's lc
agg_retrieve_direct's aggno
MultiExecBitmapIndexScan's bitmap
IndexOnlyNext's oldcontext
IndexNext's oldcontext
ExecShutdownLockRows
ExecUpdate's cols_marked_for_update, pk_is_updated
ExecModifyTable's blockInsertStmt, hasInserts, relation
get_ldap_password
auth_failed's line_to_print
CheckLDAPAuth's hba_password
HardcodedHbaLines
pq_peekbyte_impl
PostgresServerProcessMain
GetPgStrTokPtr
SetPgStrTokPtr
HIDDEN_COLUMNS_SIZE
MEGA
bitmap_exceeded_work_mem_disable_cost
compute_semi_anti_join_factors's temp_sjinfo
add_predicate_to_quals
is_hash_column_in_lsm_index
build_index_paths's found_clause
match_unsorted_outer's param_paths
make_pathkey_from_sortinfo's is_hash_index
make_indexscan's param order
move createplan's func decls to yb section
_exprcol_cmp
make_dummy_tle
has_applicable_indices
has_applicable_triggers
create_modifytable_plan local vars
create_seqscan_plan local vars
create_indexscan_plan's bitmapindex, yugabyte variables
create_indexscan_plan qpqual and local_quals dynamic is a bit strange
create_bitmap_subplan's tlist, scan_clauses
create_nestloop_plan's batched_relids
is_bnl_projection_capable
check_batchable
set_join_references's l
finalize_plan's batch_size
expand_delete_targetlist
preprocess_targetlist's rte
expand_insert_targetlist's tlist_length
translate_col_privs's firstLowInvalidAttrNumber
apply_child_basequals's childri
create_nestloop_path's inner_req_batched, outer_req_unbatched, is_batched
get_dependent_generated_columns's min_attr
add_batched_rinfo
pull_varattnos_min_attr
gram.y splitopt, grpopt, rowbounds
errhint_for_not_supported
raise_feature_not_supported_signal
+raise_feature_not_supported
+beta_features_enabled
+check_beta_feature
CreateStmtContext's relOid, isSystem
transformCreateStmt's specifies_type_oid, cell, colocation_option_specified, colocated_option_specified
INDOPTION_HASH
transformIndexConstraints's oids_used, index_elem
transformIndexStmt's is_system, cell
transformAlterTableStmt's clist, constraint
gen_prune_steps_from_func_exprs
perform_pruning_func_step
perform_func_expr_pruning
canUseFunctionForPartitionPruning
gen_partprune_steps_internal's generate_func_steps, function_clauses
CleanupKilledProcesses
postmaster_strdup
reaper's i, foundProcStruct
HandleChildCrash's level
SetOomScoreAdjForPid
SnapBuildExportSnapshotImpl
ReplicationSlotCreate's lsn_type
ReplicationSlotCleanupForProc and ReplicationSlotCleanup dynamic
ReplicationSlotCleanupForProc's proc
parseCreateReplSlotOptions's lsn_type, ordering_mode, lsn_type_given, ordering_mode_given
CreateReplicationSlot's lsn_type
adjust_view_column_set's view_rel, base_relid, view_lowattrno, base_lowattrno
FileWrite's query_termination_message
DisownLatchOnBehalfOfPid
ProcArrayRemove's foundoff
CleanupProcSignalStateInternal
CleanupProcSignalStateForProc
PROCSIG_LOG_HEAP_SNAPSHOT
PROCSIG_LOG_HEAP_SNAPSHOT_PEAK
CleanupInvalidationState (exposed to header)
CleanupInvalidationStateInternal
CleanupInvalidationStateForProc
YbConditionVariableBroadcastForProc's given_proc
LWLockQueueSelf's proc
LWLockDequeueSelf's proc
RetryMaxBackoffMsecs
RetryMinBackoffMsecs
RetryBackoffMultiplier
KilledProcToClean
TOKEN_PASSWORD
TOKEN_REDACTED
exec_simple_query's redacted_query_string, command_tag
exec_parse_message's output_dest, redacted_query_string, command_tag
exec_bind_message's redacted_query_string, command_tag
PostgresMain's oldcontext, edata, errorcontext, need_retry
CHECKPOINT_CAUSE_CLIENT
DatabaseNameBuffer
pgstat_read_current_status's attempt
pgstat_get_backend_current_activity's attempt
StringInfoSendFunctionCall
int2send_direct
int4send_direct
int8send_direct
validate_okeys_object_field_start
validate_okeys_array_start
validate_okeys_scalar
validate_okeys_object_end
json_get_int_value
json_get_denormalized_value
json_get_value
get_json_array_element
get_json_array_length
validate_json_object_keys
+HandleStatusIgnoreLockNotFound
+HandleStatusIgnoreSkipLocking
binary_upgrade_set_next_tablegroup_oid
+binary_upgrade_set_next_tablegroup_default
pg_stat_get_progress_info's index_progress, index_progress_iterator
pg_stat_get_activity's txn_infos
range_out's decode_options
RE_compile_and_cache's num_res, re_array
RI_ConstraintInfo's conindid
HasNonRITrigger
pg_get_indexdef_worker's hash_count
pg_get_indexdef_worker's indexrel
pg_get_constraintdef_worker's indexrel
get_batched_expr
get_rule_expr's before_prettyflags, rhs_type, elems, row, limit, cur_index, last_elem
SetCatCacheList
SetCatCacheTuple
RelationHasCachedLists
AddInvalidationMessage's dest
CallSystemCacheCallbacks
enable_choose_custom_plan_for_partition_pruning
num_referenced_relations
RelCacheInitFileName
RelCacheInitTempFileName
RelationGetFKeyList's iterator, use_catcache
CheckUpdateExprOrPred
CheckIndexForUpdate
RelationGetIndexAttrBitmap's attr_offset
RelCacheInitFileName
get_tablespace_distance
SysCacheName
IsMultiThreadedMode
CHECK_SYSCACHE_NAME
MAX_HOSTNAME_LENGTH
RETURN_IF_MULTITHREADED_MODE
pg_re_throw's exception_stack
INT_TYPES
FLOAT_TYPES
STR_TYPES
MODIFIERS
MAX_ATTR_LEN
FORMAT_ONE_VALUE
fmgr_init_direct_send_func
+fmgr_init_direct_send
fmgr_isbuiltin's initialized
+is_builtin_func
LogHeapSnapshotPending
LogHeapSnapshotPeakHeap
MyDatabaseColocated
MyColocatedDatabaseLegacy
InitPostgresImpl
InitPostgres's sys_table_prefetching_started
call_oid_check_hook
check_default_replica_identity
guc.c bunch of functions
ConfigureNamesOid
TOAST_LZ4_COMPRESSION
PGC_OID
parse_oid
check_reserved_prefixes
DefineCustomOidVariable
ASET_BLOCK_TOTAL_SIZE
ASET_INITIAL_TOTAL_SIZE
AllocSetDelete's freed_sz
AllocSetFree's freed_sz
Generation_CONTEXTSZ
GenerationDelete's freed_sz
GenerationFree's freed_sz
GetThreadLocalCurrentMemoryContext
SetThreadLocalCurrentMemoryContext
CreateThreadLocalCurrentMemoryContext
PrepareThreadLocalCurrentMemoryContext
ResetThreadLocalCurrentMemoryContext
DeleteThreadLocalCurrentMemoryContext
MEMORY_CONTEXT_IDENT_DISPLAY_SIZE
MemoryContextStatsUsage
SlabReset's freed_sz
SlabDelete's freed_sz
SlabFree's freed_sz
PopAllActiveSnapshots
+IsEnvSet
+exit_nicely_with_code
+make_system_platform
+enable_pg_stat_statements
getSchemaData's numTablegroups
findTablegroupByOid
+buildACLCommands order of params, certain param names
+buildACLCommands yb_sql should be replaced with firstsql, thissql, then restore firstsql, thissql later
+buildDefaultACLCommands same
DumpOptions's master_hosts, no_tablegroups*, db_oid
_doSetFixedOutputState's first_run
pg_dump.c g_verbose, is_colocated_database, is_legacy_colocated_database
dumpTablegroup
pg_dump.c's main's no_serializable_deferrable, read_time_ull, readTimeAsString
getExtensions's size
catalogTableExists
+getTablegroups
getIndexes's i_indoption
dumpConstraint's dump_index_for_constraint
+getDatabaseOid
+isDatabaseColocated
DumpableObjectType's DO_TABLEGROUP (also, this should move to the top or similar, not bottom, since PG code relies on DO_SUBSCRIPTION being last in pg_dump_sort.c)
TableInfo's primaryKeyIndex
IndxInfo's indoptions
dumpDatabases's pgdb
pg_dumpall.c masterHosts, dump_single_database
describeOneTableDetails's tgres, tablegroupbuf, colocation, database_colocated
+add_tablegroup_footer
+add_colocation_footer
+listTablegroups
Query_for_list_of_tablegroups
+exec_pipe_read_line
username.c user_id, read_user_id
get_user_name's username
appendReloptionsArray's appended
HeapTupleHeaderHasNulls
RELOPT_TYPE_OID
RELOPT_KIND_INDEX (was deleted in upstream, YB still uses it)
relopt_value.oid_val
HANDLE_OID_RELOPTION
parseRelOptions
index_build_range_scan's bfinfo, bfresult
table_index_build_range_scan's bfinfo, bfresult
execute_attr_map_cols's rel
CHECKPOINT_CAUSE_CLIENT
binary_upgrade_next_tablegroup_oid
binary_upgrade_next_tablegroup_default
index_create's split_options, skip_index_backfill, is_colocated, tablegroupId, colocationId
CatalogTupleDelete's tup
get_relation_constraint_attnos's rel
VECTOROID
CopyFormatOptions's batch_size, num_initial_skipped_rows, disable_fk_check, on_conflict_action
DEFAULT_BATCH_ROWS_PER_TRANSACTION
ExplainState.rpc
PROGRESS_COPY_STATUS
TriggerData.estate
ExprEvalStep.row_array_compare
FmgrInfo.fn_alt
TupleHashTableData.in_keyColIdx
NestLoopState.batchedtuplestorestate, nl_currentstatus
SORTBY_HASH
CreateStmt.tablegroupname, split_options
IndexStmt.split_options
IndexOptInfo.nhashcolumns
ModifyTable.no_row_trigger
IndexScan.indextlist
MAX_NEXTS_TO_AVOID_SEEK
get_singleton_append_subpath
RelationBuildPartitionDesc
PartitionPruneContext.partrelids
BackgroundWorker.bgw_oom_score_adj
PG_OUTPUT_PLUGIN
LSN_TYPE_SEQUENCE
LSN_TYPE_HYBRID_TIME
ORDERING_MODE_ROW
ORDERING_MODE_TRANSACTION
RemoveLockGroupLeader
ReleaseProcToFreeList
ACL_ALL_RIGHTS_TABLEGROUP
src/include/utils/backend_status.h "int attempt = 1;" comment has "attempt" without prefix
FmgrBuiltin.alt_func
config_var_val.oidval
GetCurrentYbMemctx
CachedPlanSource.usesPostgresRel
RelationData.primary_key_bms
RelationData.full_primary_key_bms
RelationGetColocated
RelationGetTableOid
get_loop_count
DefaultHost
spec_scanner_finish
+bigname_in
+bigname_out
+catalog_cache_compute_hash_tuple
pg_stat_statements.c pgss_shmem_startup has lots of changes
heapam_index_build_range_scan has giant indented area
GetNewOidWithIndex deletes some code. may be bad
GetNewRelFileNode same
CatalogTupleDelete signature change is major, but probably unavoidable
CopyFrom batching is complex
DefineIndex has lots of changes
ResetSequence has nontrivial moves
FirstLowInvalidHeapAttributeNumber to YBGetFirstLowInvalidAttributeNumber(rel) possible/worth?
GetCurrentFDWTuplestore lots of changes
yb_shared_update param is major change
ExecInsertIndexTuples split into that plus YbExecDoDeleteIndexTuple is major, plus more in the area such as ExecCheckIndexConstraints
changing TIDBitmap *result to YbTupleBitmap result in several places, usages changing from result == NULL to result.tbm == NULL. For example, MultiExecBitmapOr, MultiExecBitmapAnd. Probably could be better. This might be doable in this revisio.n
ExecInsert and friends are complicated
pull_varattnos to pull_varattnos_min_attr is a common pattern
+extern int yb_bnl_batch_size; scattered about is annoying
proc.c has some nontrivial changes
Int8TransTypeData needs to move from header back to c
record_out_internal, record_out dynamic
+SetCatCacheList and SearchCatCacheList and SetCatCacheTuple dynamic.
guc.c YB gucs should be at the bottom
src/bin/pg_dump/Makefile should instead symlink ysql_dump to pg_dump to avoid makefile changes
dumpTableSchema's sub of code with YbAppendReloptions3 is complicated
dumpConstraint is missing "if (nonemptyReloptions(indxinfo->indreloptions))" handling. YB commit 71d527c69554e5380788b3b20b20aa2b35d23bb2 seems to have done a lot of intrusive changes.
skipped src/bin/pgbench
_bt_sort_array_elements is moved to header
pg_proc.dat might want to put all yb items to bottom
+#define USER_AUTH_LAST uaYbJWT ---- might want to change this by moving yb objs to top
pgstat.h has lots of YB_TODOs concerning code that is removed
src/include/tcop/cmdtaglist.h -- might want to look more into this
lc_collate_is_c upstream func is exposed to builtins.h
RelationBuildPartitionKey exposed but shouldn't
src/interfaces/libpq/pqexpbuffer.c and header changes will be undone by fizaa's nicholos patch undo
pg_regress.c, pg_regress_main.c psql to ysqlsh changes are annoying
Issue Type
kind/enhancement
Warning: Please confirm that this issue does not contain any sensitive information
- I confirm this issue does not contain any sensitive information.