@@ -74,7 +74,10 @@ typedef struct vertex_hash_struct
74
74
} vertex_hash_struct ;
75
75
76
76
77
-
77
+ static vertex_hash_struct * iterator = NULL ;
78
+ static HTAB * vertex_hash = NULL ;
79
+ static HASH_SEQ_STATUS scanStatus ;
80
+ //BlackPink
78
81
/*
79
82
* * Given infomask/infomask2, compute the bits that must be saved in the
80
83
* * "infobits" field of xl_heap_delete, xl_heap_update, xl_heap_lock,
@@ -1773,6 +1776,7 @@ vertex_heapam_slot_callbacks(Relation relation)
1773
1776
return & TTSOpsBufferHeapTuple ;
1774
1777
}
1775
1778
1779
+
1776
1780
/* ------------------------------------------------------------------------
1777
1781
* Functions related to scaning
1778
1782
* ------------------------------------------------------------------------
@@ -1789,6 +1793,16 @@ TableScanDesc vertex_scan_begin(Relation relation, Snapshot snapshot, int nkeys,
1789
1793
* the scan has a pointer to it. Caller should be holding the rel open
1790
1794
* anyway, so this is redundant in all normal scenarios...
1791
1795
*/
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
+
1792
1806
RelationIncrementReferenceCount (relation );
1793
1807
1794
1808
/*
@@ -1864,7 +1878,8 @@ void vertex_scan_end(TableScanDesc sscan) {
1864
1878
HeapScanDesc scan = (HeapScanDesc ) sscan ;
1865
1879
1866
1880
/* Note: no locking manipulations needed */
1867
-
1881
+ hash_seq_term (& scanStatus );
1882
+ //BlackPink
1868
1883
/*
1869
1884
* unpin scan buffers
1870
1885
*/
@@ -1928,6 +1943,17 @@ bool vertex_scan_getnextslot(TableScanDesc sscan, ScanDirection direction,
1928
1943
pgstat_count_heap_getnext (scan -> rs_base .rs_rd );
1929
1944
1930
1945
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
+
1931
1957
return true;
1932
1958
}
1933
1959
@@ -2150,7 +2176,7 @@ void vertex_tuple_insert(Relation relation, TupleTableSlot *slot,
2150
2176
MemSet (& hash_ctl , 0 , sizeof (hash_ctl ));
2151
2177
hash_ctl .keysize = sizeof (graphid );
2152
2178
hash_ctl .entrysize = sizeof (vertex_hash_struct );
2153
-
2179
+ //BlackPink
2154
2180
HTAB * rel_hash_table = ShmemInitHash (RelationGetRelationName (relation ),16 , 1000 , & hash_ctl ,
2155
2181
HASH_ELEM | HASH_BLOBS | HASH_COMPARE );
2156
2182
bool found ;
0 commit comments