LCOV - code coverage report
Current view: top level - gdk - gdk_delta.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 6 100.0 %
Date: 2024-10-04 20:04:04 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * SPDX-License-Identifier: MPL-2.0
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * Copyright 2024 MonetDB Foundation;
       9             :  * Copyright August 2008 - 2023 MonetDB B.V.;
      10             :  * Copyright 1997 - July 2008 CWI.
      11             :  */
      12             : 
      13             : /*
      14             :  * @a M. L. Kersten, P. Boncz, N. Nes
      15             :  * @* Delta management
      16             :  * The basis for transaction management is to keep track of elements
      17             :  * inserted, deleted, and replaced.  This information is stored within
      18             :  * the BAT structure using three delta markers.  Inserted denotes the
      19             :  * first added BUN since the last commit. Deleted points to the BUNs
      20             :  * removed.  The deletion list is terminated at @%first@, where space
      21             :  * is reserved for swapping BUNs upon deletion. Initialization of the
      22             :  * BAT is extended as follows:
      23             :  */
      24             : 
      25             : /*
      26             :  * Impact on hashing and indexing.  The hash structure is maintained
      27             :  * for all elements to be deleted ?.
      28             :  */
      29             : #include "monetdb_config.h"
      30             : #include "gdk.h"
      31             : #include "gdk_private.h"
      32             : 
      33             : /*
      34             :  * batcommit really forgets the atoms guarded for an undo; we just
      35             :  * need to free their heap space (only if necessary).
      36             :  */
      37             : void
      38          19 : BATcommit(BAT *b, BUN size)
      39             : {
      40             :         /* called with theaplock held (or otherwise save from concurrent use) */
      41          19 :         if (b == NULL)
      42             :                 return;
      43          19 :         assert(size <= BATcount(b) || size == BUN_NONE);
      44          19 :         TRC_DEBUG(DELTA, "BATcommit1 %s free %zu ins " BUNFMT " base %p\n",
      45             :                   BATgetId(b), b->theap->free, b->batInserted, b->theap->base);
      46          19 :         b->batInserted = size < BATcount(b) ? size : BATcount(b);
      47          19 :         TRC_DEBUG(DELTA, "BATcommit2 %s free %zu ins " BUNFMT " base %p\n",
      48             :                   BATgetId(b), b->theap->free, b->batInserted, b->theap->base);
      49             : }

Generated by: LCOV version 1.14