diff options
author | Andres Freund <andres@anarazel.de> | 2019-05-23 16:25:48 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-05-23 16:32:36 -0700 |
commit | 73b8c3bd2889fed986044e15aefd0911f96ccdd3 (patch) | |
tree | 8fcd867ac811feecc99ed5f645088b73c44d5051 /src/include/access/tableam.h | |
parent | 54487d1560619a0027e0651d1b8d715ca8fc388c (diff) |
tableam: Rename wrapper functions to match callback names.
Some of the wrapper functions didn't match the callback names. Many of
them due to staying "consistent" with historic naming of the wrapped
functionality. We decided that for most cases it's more important to
be for tableam to be consistent going forward, than with the past.
The one exception is beginscan/endscan/... because it'd have looked
odd to have systable_beginscan/endscan/... with a different naming
scheme, and changing the systable_* APIs would have caused way too
much churn (including breaking a lot of external users).
Author: Ashwin Agrawal, with some small additions by Andres Freund
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CALfoeiugyrXZfX7n0ORCa4L-m834dzmaE8eFdbNR6PMpetU4Ww@mail.gmail.com
Diffstat (limited to 'src/include/access/tableam.h')
-rw-r--r-- | src/include/access/tableam.h | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h index 6f1cd382d82..bf3a4720183 100644 --- a/src/include/access/tableam.h +++ b/src/include/access/tableam.h @@ -101,9 +101,9 @@ typedef enum TM_Result } TM_Result; /* - * When table_update, table_delete, or table_lock_tuple fail because the target - * tuple is already outdated, they fill in this struct to provide information - * to the caller about what happened. + * When table_tuple_update, table_tuple_delete, or table_tuple_lock fail + * because the target tuple is already outdated, they fill in this struct to + * provide information to the caller about what happened. * * ctid is the target's ctid link: it is the same as the target's TID if the * target was deleted, or the location of the replacement tuple if the target @@ -127,13 +127,13 @@ typedef struct TM_FailureData bool traversed; } TM_FailureData; -/* "options" flag bits for table_insert */ +/* "options" flag bits for table_tuple_insert */ #define TABLE_INSERT_SKIP_WAL 0x0001 #define TABLE_INSERT_SKIP_FSM 0x0002 #define TABLE_INSERT_FROZEN 0x0004 #define TABLE_INSERT_NO_LOGICAL 0x0008 -/* flag bits for table_lock_tuple */ +/* flag bits for table_tuple_lock */ /* Follow tuples whose update is in progress if lock modes don't conflict */ #define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS (1 << 0) /* Follow update chain and lock latest version of tuple */ @@ -352,12 +352,12 @@ typedef struct TableAmRoutine * ------------------------------------------------------------------------ */ - /* see table_insert() for reference about parameters */ + /* see table_tuple_insert() for reference about parameters */ void (*tuple_insert) (Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate); - /* see table_insert_speculative() for reference about parameters */ + /* see table_tuple_insert_speculative() for reference about parameters */ void (*tuple_insert_speculative) (Relation rel, TupleTableSlot *slot, CommandId cid, @@ -365,7 +365,7 @@ typedef struct TableAmRoutine struct BulkInsertStateData *bistate, uint32 specToken); - /* see table_complete_speculative() for reference about parameters */ + /* see table_tuple_complete_speculative() for reference about parameters */ void (*tuple_complete_speculative) (Relation rel, TupleTableSlot *slot, uint32 specToken, @@ -375,7 +375,7 @@ typedef struct TableAmRoutine void (*multi_insert) (Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate); - /* see table_delete() for reference about parameters */ + /* see table_tuple_delete() for reference about parameters */ TM_Result (*tuple_delete) (Relation rel, ItemPointer tid, CommandId cid, @@ -385,7 +385,7 @@ typedef struct TableAmRoutine TM_FailureData *tmfd, bool changingPart); - /* see table_update() for reference about parameters */ + /* see table_tuple_update() for reference about parameters */ TM_Result (*tuple_update) (Relation rel, ItemPointer otid, TupleTableSlot *slot, @@ -397,7 +397,7 @@ typedef struct TableAmRoutine LockTupleMode *lockmode, bool *update_indexes); - /* see table_lock_tuple() for reference about parameters */ + /* see table_tuple_lock() for reference about parameters */ TM_Result (*tuple_lock) (Relation rel, ItemPointer tid, Snapshot snapshot, @@ -976,7 +976,7 @@ table_index_fetch_end(struct IndexFetchTableData *scan) * supports storing multiple row versions reachable via a single index entry * (like heap's HOT). Whereas table_fetch_row_version only evaluates the * tuple exactly at `tid`. Outside of index entry ->table tuple lookups, - * table_fetch_row_version is what's usually needed. + * table_tuple_fetch_row_version is what's usually needed. */ static inline bool table_index_fetch_tuple(struct IndexFetchTableData *scan, @@ -1019,10 +1019,10 @@ extern bool table_index_fetch_tuple_check(Relation rel, * index entry->table tuple lookups. */ static inline bool -table_fetch_row_version(Relation rel, - ItemPointer tid, - Snapshot snapshot, - TupleTableSlot *slot) +table_tuple_fetch_row_version(Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot) { return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot); } @@ -1045,7 +1045,7 @@ table_tuple_tid_valid(TableScanDesc scan, ItemPointer tid) * Return the latest version of the tuple at `tid`, by updating `tid` to * point at the newest version. */ -extern void table_get_latest_tid(TableScanDesc scan, ItemPointer tid); +extern void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid); /* * Return true iff tuple in slot satisfies the snapshot. @@ -1122,8 +1122,8 @@ table_compute_xid_horizon_for_tuples(Relation rel, * reflected in the slots contents. */ static inline void -table_insert(Relation rel, TupleTableSlot *slot, CommandId cid, - int options, struct BulkInsertStateData *bistate) +table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, + int options, struct BulkInsertStateData *bistate) { rel->rd_tableam->tuple_insert(rel, slot, cid, options, bistate); @@ -1138,12 +1138,13 @@ table_insert(Relation rel, TupleTableSlot *slot, CommandId cid, * * A transaction having performed a speculative insertion has to either abort, * or finish the speculative insertion with - * table_complete_speculative(succeeded = ...). + * table_tuple_complete_speculative(succeeded = ...). */ static inline void -table_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid, - int options, struct BulkInsertStateData *bistate, - uint32 specToken) +table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, + CommandId cid, int options, + struct BulkInsertStateData *bistate, + uint32 specToken) { rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options, bistate, specToken); @@ -1154,8 +1155,8 @@ table_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid, * succeeded is true, the tuple is fully inserted, if false, it's removed. */ static inline void -table_complete_speculative(Relation rel, TupleTableSlot *slot, - uint32 specToken, bool succeeded) +table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, + uint32 specToken, bool succeeded) { rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken, succeeded); @@ -1170,7 +1171,7 @@ table_complete_speculative(Relation rel, TupleTableSlot *slot, * * Except for taking `nslots` tuples as input, as an array of TupleTableSlots * in `slots`, the parameters for table_multi_insert() are the same as for - * table_insert(). + * table_tuple_insert(). * * Note: this leaks memory into the current memory context. You can create a * temporary context before calling this, if that's a problem. @@ -1187,7 +1188,7 @@ table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, * Delete a tuple. * * NB: do not call this directly unless prepared to deal with - * concurrent-update conditions. Use simple_table_delete instead. + * concurrent-update conditions. Use simple_table_tuple_delete instead. * * Input parameters: * relation - table to be modified (caller must hold suitable lock) @@ -1210,9 +1211,9 @@ table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, * struct TM_FailureData for additional info. */ static inline TM_Result -table_delete(Relation rel, ItemPointer tid, CommandId cid, - Snapshot snapshot, Snapshot crosscheck, bool wait, - TM_FailureData *tmfd, bool changingPart) +table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, + Snapshot snapshot, Snapshot crosscheck, bool wait, + TM_FailureData *tmfd, bool changingPart) { return rel->rd_tableam->tuple_delete(rel, tid, cid, snapshot, crosscheck, @@ -1223,7 +1224,7 @@ table_delete(Relation rel, ItemPointer tid, CommandId cid, * Update a tuple. * * NB: do not call this directly unless you are prepared to deal with - * concurrent-update conditions. Use simple_table_update instead. + * concurrent-update conditions. Use simple_table_tuple_update instead. * * Input parameters: * relation - table to be modified (caller must hold suitable lock) @@ -1254,10 +1255,10 @@ table_delete(Relation rel, ItemPointer tid, CommandId cid, * for additional info. */ static inline TM_Result -table_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, - CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, - TM_FailureData *tmfd, LockTupleMode *lockmode, - bool *update_indexes) +table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, + CommandId cid, Snapshot snapshot, Snapshot crosscheck, + bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, + bool *update_indexes) { return rel->rd_tableam->tuple_update(rel, otid, slot, cid, snapshot, crosscheck, @@ -1299,7 +1300,7 @@ table_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, * comments for struct TM_FailureData for additional info. */ static inline TM_Result -table_lock_tuple(Relation rel, ItemPointer tid, Snapshot snapshot, +table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd) @@ -1703,12 +1704,12 @@ table_scan_sample_next_tuple(TableScanDesc scan, * ---------------------------------------------------------------------------- */ -extern void simple_table_insert(Relation rel, TupleTableSlot *slot); -extern void simple_table_delete(Relation rel, ItemPointer tid, - Snapshot snapshot); -extern void simple_table_update(Relation rel, ItemPointer otid, - TupleTableSlot *slot, Snapshot snapshot, - bool *update_indexes); +extern void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot); +extern void simple_table_tuple_delete(Relation rel, ItemPointer tid, + Snapshot snapshot); +extern void simple_table_tuple_update(Relation rel, ItemPointer otid, + TupleTableSlot *slot, Snapshot snapshot, + bool *update_indexes); /* ---------------------------------------------------------------------------- |