@@ -74,7 +74,10 @@ typedef struct vertex_hash_struct
7474} vertex_hash_struct ;
7575
7676
77-
77+ static vertex_hash_struct * iterator = NULL ;
78+ static HTAB * vertex_hash = NULL ;
79+ static HASH_SEQ_STATUS scanStatus ;
80+ //BlackPink
7881/*
7982 * * Given infomask/infomask2, compute the bits that must be saved in the
8083 * * "infobits" field of xl_heap_delete, xl_heap_update, xl_heap_lock,
@@ -1773,6 +1776,7 @@ vertex_heapam_slot_callbacks(Relation relation)
17731776 return & TTSOpsBufferHeapTuple ;
17741777}
17751778
1779+
17761780/* ------------------------------------------------------------------------
17771781 * Functions related to scaning
17781782 * ------------------------------------------------------------------------
@@ -1789,6 +1793,16 @@ TableScanDesc vertex_scan_begin(Relation relation, Snapshot snapshot, int nkeys,
17891793 * the scan has a pointer to it. Caller should be holding the rel open
17901794 * anyway, so this is redundant in all normal scenarios...
17911795 */
1796+ HASHCTL hash_ctl ;
1797+ //BlackPink
1798+ MemSet (& hash_ctl , 0 , sizeof (hash_ctl ));
1799+ hash_ctl .keysize = sizeof (graphid );
1800+ hash_ctl .entrysize = sizeof (vertex_hash_struct );
1801+ vertex_hash = ShmemInitHash (RelationGetRelationName (relation ),16 , 1000 , & hash_ctl ,
1802+ HASH_ELEM | HASH_BLOBS | HASH_COMPARE );
1803+ hash_seq_init (& scanStatus , vertex_hash );
1804+
1805+
17921806 RelationIncrementReferenceCount (relation );
17931807
17941808 /*
@@ -1864,7 +1878,8 @@ void vertex_scan_end(TableScanDesc sscan) {
18641878 HeapScanDesc scan = (HeapScanDesc ) sscan ;
18651879
18661880 /* Note: no locking manipulations needed */
1867-
1881+ hash_seq_term (& scanStatus );
1882+ //BlackPink
18681883 /*
18691884 * unpin scan buffers
18701885 */
@@ -1928,6 +1943,17 @@ bool vertex_scan_getnextslot(TableScanDesc sscan, ScanDirection direction,
19281943 pgstat_count_heap_getnext (scan -> rs_base .rs_rd );
19291944
19301945 ExecStoreBufferHeapTuple (& scan -> rs_ctup , slot , scan -> rs_cbuf );
1946+
1947+ //BlackPink
1948+ if ((iterator = hash_seq_search (& scanStatus )) != NULL ) {
1949+ slot -> tts_values [0 ] = GRAPHID_GET_DATUM (iterator -> id );
1950+ slot -> tts_values [1 ] = GTYPE_P_GET_DATUM (iterator -> properties );
1951+ } else {
1952+ return false;
1953+ }
1954+
1955+
1956+
19311957 return true;
19321958}
19331959
@@ -2150,7 +2176,7 @@ void vertex_tuple_insert(Relation relation, TupleTableSlot *slot,
21502176 MemSet (& hash_ctl , 0 , sizeof (hash_ctl ));
21512177 hash_ctl .keysize = sizeof (graphid );
21522178 hash_ctl .entrysize = sizeof (vertex_hash_struct );
2153-
2179+ //BlackPink
21542180 HTAB * rel_hash_table = ShmemInitHash (RelationGetRelationName (relation ),16 , 1000 , & hash_ctl ,
21552181 HASH_ELEM | HASH_BLOBS | HASH_COMPARE );
21562182 bool found ;
0 commit comments