| 972 | } |
| 973 | |
| 974 | bool deeplake_table_am_routine::index_fetch_tuple(struct IndexFetchTableData* scan, |
| 975 | ItemPointer tid, |
| 976 | Snapshot snapshot, |
| 977 | TupleTableSlot* slot, |
| 978 | bool* call_again, |
| 979 | bool* all_dead) |
| 980 | { |
| 981 | CHECK_FOR_INTERRUPTS(); |
| 982 | |
| 983 | DeeplakeIndexFetchData* idx_scan = get_index_fetch_data(scan); |
| 984 | |
| 985 | if (idx_scan->scan_state.get_current_position() % num_tuples_to_reset_memory_context == 0) { |
| 986 | MemoryContextReset(idx_scan->memory_context); |
| 987 | } |
| 988 | |
| 989 | pg::utils::memory_context_switcher context_switcher(idx_scan->memory_context); |
| 990 | idx_scan->scan_state.set_current_position(utils::tid_to_row_number(tid)); |
| 991 | |
| 992 | if (!idx_scan->scan_state.get_next_tuple(slot)) { |
| 993 | if (all_dead != nullptr) { |
| 994 | *all_dead = true; |
| 995 | } |
| 996 | return false; |
| 997 | } |
| 998 | |
| 999 | // For SNAPSHOT_DIRTY (used by btree unique checking), |
| 1000 | // we need to indicate that no in-progress transaction is affecting this tuple. |
| 1001 | // This prevents PostgreSQL from trying to look up transaction status in pg_subtrans. |
| 1002 | // Deeplake tuples are always immediately visible (no MVCC). |
| 1003 | if (snapshot != nullptr && snapshot->snapshot_type == SNAPSHOT_DIRTY) { |
| 1004 | snapshot->xmin = InvalidTransactionId; |
| 1005 | snapshot->xmax = InvalidTransactionId; |
| 1006 | } |
| 1007 | |
| 1008 | *call_again = false; |
| 1009 | if (all_dead != nullptr) { |
| 1010 | *all_dead = false; |
| 1011 | } |
| 1012 | return true; |
| 1013 | } |
| 1014 | |
| 1015 | void deeplake_table_am_routine::tuple_insert( |
| 1016 | Relation rel, TupleTableSlot* slot, CommandId cid, int32_t options, struct BulkInsertStateData* bistate) |
nothing calls this directly
no test coverage detected