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

Function buf_ensure_head_space

src/backend/access/bitmap/bitmapinsert.c:1961–1974  ·  view source on GitHub ↗

* buf_ensure_head_space() -- If there is no space in the header words, * move words in the given buffer to disk and free the existing space, * and then allocate new space for future new words. * * The number of bytes freed are returned. */

Source from the content-addressed store, hash-verified

1959 * The number of bytes freed are returned.
1960 */
1961static uint16
1962buf_ensure_head_space(Relation rel, BMTIDBuffer *buf,
1963 Buffer lovBuffer, OffsetNumber off, bool use_wal)
1964{
1965 uint16 bytes_freed = 0;
1966
1967 if (buf->curword >= (BM_NUM_OF_HEADER_WORDS * BM_HRL_WORD_SIZE))
1968 {
1969 bytes_freed = buf_free_mem_block(rel, buf, lovBuffer, off, use_wal);
1970 bytes_freed -= buf_extend(buf);
1971 }
1972
1973 return bytes_freed;
1974}
1975
1976/*
1977 * buf_extend() -- Enlarge the memory allocated to a buffer.

Callers 1

buf_add_tid_with_fillFunction · 0.85

Calls 2

buf_free_mem_blockFunction · 0.85
buf_extendFunction · 0.85

Tested by

no test coverage detected