MCPcopy Create free account
hub / github.com/apache/cloudberry / _bitmap_insert_lov

Function _bitmap_insert_lov

src/backend/access/bitmap/bitmapattutil.c:329–375  ·  view source on GitHub ↗

* _bitmap_insert_lov() -- insert a new data into the given heap and index. */

Source from the content-addressed store, hash-verified

327 * _bitmap_insert_lov() -- insert a new data into the given heap and index.
328 */
329void
330_bitmap_insert_lov(Relation lovHeap, Relation lovIndex, Datum *datum,
331 bool *nulls, bool use_wal pg_attribute_unused())
332{
333 TupleDesc tupDesc;
334 HeapTuple tuple;
335 bool result;
336 Datum *indexDatum;
337 bool *indexNulls;
338
339 tupDesc = RelationGetDescr(lovHeap);
340
341 /* insert this tuple into the heap */
342 tuple = heap_form_tuple(tupDesc, datum, nulls);
343 simple_heap_insert(lovHeap, tuple);
344
345 /* insert a new tuple into the index */
346 indexDatum = palloc0((tupDesc->natts - 2) * sizeof(Datum));
347 indexNulls = palloc0((tupDesc->natts - 2) * sizeof(bool));
348 memcpy(indexDatum, datum, (tupDesc->natts - 2) * sizeof(Datum));
349 memcpy(indexNulls, nulls, (tupDesc->natts - 2) * sizeof(bool));
350 result = index_insert(lovIndex, indexDatum, indexNulls,
351 &(tuple->t_self), lovHeap, true, false, NULL);
352
353#ifdef FAULT_INJECTOR
354 FaultInjector_InjectFaultIfSet(
355 "insert_bmlov_before_freeze",
356 DDLNotSpecified,
357 "", //databaseName
358 RelationGetRelationName(lovHeap));
359#endif
360 /* freeze the tuple */
361 heap_freeze_tuple_wal_logged(lovHeap, tuple);
362
363#ifdef FAULT_INJECTOR
364 FaultInjector_InjectFaultIfSet(
365 "insert_bmlov_after_freeze",
366 DDLNotSpecified,
367 "", //databaseName
368 RelationGetRelationName(lovHeap));
369#endif
370 pfree(indexDatum);
371 pfree(indexNulls);
372 Assert(result);
373
374 heap_freetuple(tuple);
375}
376
377
378/*

Callers 1

create_lovitemFunction · 0.85

Calls 7

heap_form_tupleFunction · 0.85
simple_heap_insertFunction · 0.85
index_insertFunction · 0.85
heap_freetupleFunction · 0.85
palloc0Function · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected