aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/tableam.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/access/tableam.h')
-rw-r--r--src/include/access/tableam.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 9bc1d24b4a6..4efe178ed1e 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -380,6 +380,21 @@ typedef struct TableAmRoutine
uint8 flags,
TM_FailureData *tmfd);
+ /*
+ * Perform operations necessary to complete insertions made via
+ * tuple_insert and multi_insert with a BulkInsertState specified. This
+ * e.g. may e.g. used to flush the relation when inserting with
+ * TABLE_INSERT_SKIP_WAL specified.
+ *
+ * Typically callers of tuple_insert and multi_insert will just pass all
+ * the flags the apply to them, and each AM has to decide which of them
+ * make sense for it, and then only take actions in finish_bulk_insert
+ * that make sense for a specific AM.
+ *
+ * Optional callback.
+ */
+ void (*finish_bulk_insert) (Relation rel, int options);
+
/* ------------------------------------------------------------------------
* DDL related functionality.
@@ -1011,7 +1026,8 @@ table_compute_xid_horizon_for_tuples(Relation rel,
*
*
* The BulkInsertState object (if any; bistate can be NULL for default
- * behavior) is also just passed through to RelationGetBufferForTuple.
+ * behavior) is also just passed through to RelationGetBufferForTuple. If
+ * `bistate` is provided, table_finish_bulk_insert() needs to be called.
*
* On return the slot's tts_tid and tts_tableOid are updated to reflect the
* insertion. But note that any toasting of fields within the slot is NOT
@@ -1185,6 +1201,20 @@ table_lock_tuple(Relation rel, ItemPointer tid, Snapshot snapshot,
flags, tmfd);
}
+/*
+ * Perform operations necessary to complete insertions made via
+ * tuple_insert and multi_insert with a BulkInsertState specified. This
+ * e.g. may e.g. used to flush the relation when inserting with
+ * TABLE_INSERT_SKIP_WAL specified.
+ */
+static inline void
+table_finish_bulk_insert(Relation rel, int options)
+{
+ /* optional callback */
+ if (rel->rd_tableam && rel->rd_tableam->finish_bulk_insert)
+ rel->rd_tableam->finish_bulk_insert(rel, options);
+}
+
/* ------------------------------------------------------------------------
* DDL related functionality.