void HeapBubbleUp(int pos) { int parent = HeapParent(pos); if (HeapDominates(pos, parent)) { HeapSwap(pos, parent); HeapBubbleUp(parent); } }
void ValueTableOpLogMeta::HeapBuildMaxHeap() { if (heap_size_ == 0) return; int32_t sort_index = HeapParent((heap_size_ - 1)); while (sort_index >= 0) { HeapMaxHeapify(sort_index); sort_index--; } }
void ValueTableOpLogMeta::HeapIncrease( int32_t index, const RowOpLogMeta &row_oplog_meta) { heap_[index].importance += row_oplog_meta.get_importance(); if (heap_[index].clock == -1 || heap_[index].clock > row_oplog_meta.get_clock()) { heap_[index].clock = row_oplog_meta.get_clock(); } int32_t check_index = index; while (check_index != 0) { int32_t parent_index = HeapParent(check_index); if (CompRowOpLogMeta(heap_[check_index], heap_[parent_index])) { HeapSwap(check_index, parent_index); check_index = parent_index; } else { break; } } }