Skip to content

Commit

Permalink
[YDBTest#501] [DEBUG-ONLY] ydb_test_4g_db_blks env var allows creatio…
Browse files Browse the repository at this point in the history
…n of databases with > 4Gib blocks

Background
----------
* GT.M V7.0-000 added support for up to 16Gi blocks in a region (see YDBTest#501 for details).

* Once the block number goes more than 4Gi, it becomes an 8-byte value. So GT.M had to change
  all usages of 4-byte block numbers in the code base (using `block_id` type) to 8-byte values.

* YDBTest#501 had to test this change. But testing it was not straightforward as more than 4GiB
  blocks meant creating a 2 terabyte file even with the smallest block size of 512 bytes. With a
  default block size of 4KiB, it meant creating an 8 terabyte file. Although such huge files are
  sparse, the database structure implied a bitmap block every 512 blocks which meant the database
  file in the file system will be a huge file where only 1 in every 512 block is allocated. But
  even such a file would end up taking a lot of space and take a lot of time to create making it
  very difficult to run the entire suite of YDBTest tests with such huge database files.

Solution
--------
* Below is pasted from https://gitlab.com/YottaDB/DB/YDBTest/-/issues/501#note_1468633286.

  For the record. This is an idea to test block numbers greater than 4GiB (i.e. where the higher order
  4-byte is non-zero) without the overhead of test runtime due to creating bitmaps (which happen every
  512 blocks) in the database file.

  A debug-build only env var `ydb_test_4g_db_blks` will be honored by YottaDB. If this var is undefined
  or set to 0, then there is no change. But if this is set to a non-zero value, it indicates the size of
  the HOLE in the database starting from local bitmap number `1` (i.e. database block number `512`). Any
  database block (including bitmap blocks) in the range from block 512 to the bitmap block number specified
  by the env var will not be allocated/used by the database logic. This way we force the database logic
  to allocate blocks past the HOLE effectively getting into 8-byte block number territory without actually
  allocating HUGE files in the file system. The created database file will be a giant sparse file.

* If this env var is set to the value `8388608`, the size of the database file with a default block size
  of 4KiB would be 16TiB (16 terabytes) and the database would support 4GiB blocks.

Implementation
--------------
* The value of the env var `ydb_test_4g_db_blks` is stored in the debug-only global variable `ydb_skip_bml_num`
  (defined in `sr_port/gbldefs.c`). This happens in `sr_port/gtm_env_init.c`.

  Since this is a new env var, there is a new line in `sr_port/ydb_logicals_tab.h`.

* The YDBTest test system framework will be changed separately to run all existing tests with this env var
  set to the value `8388608`.

* Various files had to be modified in this commit to ensure the database code does not use any block
  in the range from local bitmap block `512` upto (but not including) the local bitmap block number
  specified by `$ydb_test_4g_db_blks * 512` thus creating a big HOLE in the database file after block `511`.

* Below is a high level list of the changes that happened.
  - MUPIP CREATE and MUPIP EXTEND create the HOLE as appropriate (mucregini.c, mu_cre_file.c, mu_int_maps.c,
    gdsfilext.c and gdsfilext_nojnl.c). They accurately maintains `total_blks` and `free_blks` even when
    there is a HOLE. Blocks in the HOLE are counted towards both these counters.
  - `bm_getfree.c` ensures any newly allocated blocks are not in the HOLE.
  - The following commands skip/honor/ignore the HOLE.
    - MUPIP REORG UPGRADE/DOWNGRADE (`sr_port/mu_reorg_upgrd_dwngrd.c`)
    - MUPIP REORG (in `mu_swap_blk.c` and `sr_unix/mu_swap_root.c`)
    - MUPIP REORG -TRUNCATE (`sr_unix/mu_truncate.c`)
    - MUPIP INTEG (in `sr_unix/mu_int_init.c`, `sr_port/mu_int_maps.c` and `sr_port/mupip_integ.c`)
    - MUPIP RESTORE (in `sr_unix/mupip_restore.c`)
    - DSE MAPS (in `sr_port/dse_maps.c`)
    - MUPIP BACKUP -INCREMENTAL (in `sr_unix/mubinccpy.c`)
    - DSE RANGE (in `sr_port/dse_range.c`)
  - DB_LSEEKREAD (in `sr_unix/gtmio.h`) and DB_LSEEKWRITE (in `sr_port/anticipatory_freeze.h`) macros now
    have asserts to ensure we never read/write any block in the HOLE. One exception was that the function
    `db_write_eof_block()` writes data at the end of the database file which could end up being in the HOLE
    in case the database has blocks 0 to 511 allocated presently. Therefore the asserts were avoided in that
    case by temporarily resetting `ydb_skip_bml_num` to 0.
  - `dsk_read.c` needed to handle read of a block in the HOLE region (possible due to concurrency issues).
  - `warn_db_sz.c` needed to not issue a LOWSPC warning when huge db files are in use. Or else one would
    see test failures due to these extra messages whenever the env var is randomly enabled by the tests.

Bugs identified
---------------
* Below was a pre-existing GT.M V7.0-000 code issue I noticed after the changes in this commit.
  The `mu_int_blks_to_upgrd` global variable counted the number of blocks but was typed as `int4`.
  It should have been changed to `block_id`. This got missed out in GT.M V7.0-000. And is fixed in this
  commit. Interestingly, the same fix happened on the GT.M side in V7.1-000.

* Additionally, I noticed a few missing 4-byte to 8-byte conversions thanks to the changes in the above bullets.
  They are the following and are fixed in this commit to use `block_id` instead of `int4`/`uint4`.
  - `freeblks` local variable in `sr_port/mur_process_intrpt_recov.c`
  - `i` and `fcnt` local variables in `sr_port/mur_blocks_free.c`
  - Return value of `mur_blocks_free()` (which returns the number of free blocks and hence should be 8-byte)
  • Loading branch information
nars1 committed Jul 14, 2023
1 parent aed0e78 commit ea9950a
Show file tree
Hide file tree
Showing 28 changed files with 349 additions and 28 deletions.
11 changes: 10 additions & 1 deletion sr_port/anticipatory_freeze.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2012-2020 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2018-2020 YottaDB LLC and/or its subsidiaries. *
* Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
Expand Down Expand Up @@ -335,6 +335,10 @@ MBSTART { \
#define DB_LSEEKWRITE_HANG(CSA) FALSE
#endif

#ifdef DEBUG
GBLREF gtm_int8 ydb_skip_bml_num; /* Use "gtm_int8" since it is possible "block_id" type is not yet defined */
#endif

/* #GTM_THREAD_SAFE : The below macro (DB_LSEEKWRITE) is thread-safe */
#define DB_LSEEKWRITE(CSA, UDI, DB_FN, FD, OFFSET, BUFF, SIZE, STATUS) \
MBSTART { \
Expand All @@ -344,6 +348,11 @@ MBSTART { \
assert(!CSA_LOCAL || !CSA_LOCAL->region || FILE_INFO(CSA_LOCAL->region)->grabbed_access_sem \
|| !(CSA_LOCAL)->nl || !FROZEN_CHILLED(CSA_LOCAL) || FREEZE_LATCH_HELD(CSA_LOCAL)); \
DBG_CHECK_DIO_ALIGNMENT(UDI, OFFSET, BUFF, SIZE); \
assert((0 == ydb_skip_bml_num) || (NULL == UDI) || (0 == OFFSET) \
|| ((BLK_ZERO_OFF(((unix_db_info *)UDI)->s_addrs.hdr->start_vbn) \
+ ((gtm_int8)BLKS_PER_LMAP * ((unix_db_info *)UDI)->s_addrs.hdr->blk_size)) > OFFSET) \
|| ((BLK_ZERO_OFF(((unix_db_info *)UDI)->s_addrs.hdr->start_vbn) \
+ (ydb_skip_bml_num * ((unix_db_info *)UDI)->s_addrs.hdr->blk_size)) <= OFFSET)); \
/* We should never write to a READ_ONLY db file header unless we hold standalone access on the db */ \
assert((0 != OFFSET) || !((sgmnt_data_ptr_t)BUFF)->read_only || (NULL == UDI) || UDI->grabbed_access_sem); \
DO_LSEEKWRITE(CSA_LOCAL, DB_FN, FD, OFFSET, BUFF, SIZE, STATUS, fake_db_enospc, DB_LSEEKWRITE_HANG(CSA), \
Expand Down
31 changes: 31 additions & 0 deletions sr_port/bm_getfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ GBLREF uint4 dollar_tlevel;
GBLREF uint4 update_array_size, cumul_update_array_size;
GBLREF unsigned int t_tries;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

error_def(ERR_DBBADFREEBLKCTR);
error_def(ERR_DBMBMINCFREFIXED);

Expand All @@ -89,6 +93,10 @@ block_id bm_getfree(block_id hint, boolean_t *blk_used, unsigned int cw_work, cw
total_blks = (dba_mm == cs_data->acc_meth) ? cs_addrs->total_blks : cs_addrs->ti->total_blks;
if (hint >= total_blks) /* for TP, hint can be > total_blks */
hint = 1;
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP <= hint) && (hint < ydb_skip_bml_num))
hint = ydb_skip_bml_num;
# endif
hint_cycled = DIVIDE_ROUND_UP(total_blks, BLKS_PER_LMAP);
hint_limit = DIVIDE_ROUND_DOWN(hint, BLKS_PER_LMAP);
local_maps = hint_cycled + 2; /* for (up to) 2 wraps */
Expand All @@ -102,6 +110,10 @@ block_id bm_getfree(block_id hint, boolean_t *blk_used, unsigned int cw_work, cw
{
hint_cycled = hint_limit;
hint = 1;
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP <= hint) && (hint < ydb_skip_bml_num))
hint = ydb_skip_bml_num;
# endif
continue;
}
if (SS_NORMAL != (status = GDSFILEXT(cs_data->extension_size, total_blks, TRANS_IN_PROG_TRUE)))
Expand All @@ -125,6 +137,13 @@ block_id bm_getfree(block_id hint, boolean_t *blk_used, unsigned int cw_work, cw
continue;
}
bml *= BLKS_PER_LMAP;
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP <= bml) && (bml < ydb_skip_bml_num))
{
hint = ydb_skip_bml_num + 1;
continue;
}
# endif
if (ROUND_DOWN2(hint, BLKS_PER_LMAP) != bml)
{ /* not within requested map */
if ((bml < hint) && (hint_cycled)) /* wrap? - second one should force an extend for sure */
Expand Down Expand Up @@ -271,6 +290,17 @@ boolean_t is_free_blks_ctr_ok(void)
local_maps = DIVIDE_ROUND_UP(total_blks, BLKS_PER_LMAP);
for (free_blocks = 0, free_bml = 0; free_bml < local_maps; free_bml++)
{
# ifdef DEBUG
if ((0 != ydb_skip_bml_num)
&& (BLKS_PER_LMAP <= (BLKS_PER_LMAP * free_bml))
&& ((BLKS_PER_LMAP * free_bml) < ydb_skip_bml_num))
{
free_bml = (ydb_skip_bml_num / BLKS_PER_LMAP) - 1;
/* - 1 to compensate the "free_bml++" done in "for" loop line */
free_blocks += (ydb_skip_bml_num - BLKS_PER_LMAP) / BLKS_PER_LMAP * (BLKS_PER_LMAP - 1);
continue;
}
# endif
bml = bmm_find_free((uint4)free_bml, (sm_uc_ptr_t)MM_ADDR(cs_data), local_maps);
if (bml < free_bml)
break;
Expand Down Expand Up @@ -299,6 +329,7 @@ boolean_t is_free_blks_ctr_ok(void)
assert(cs_addrs->ti->free_blocks == free_blocks);
if (cs_addrs->ti->free_blocks != free_blocks)
{
assert(FALSE);
send_msg_csa(CSA_ARG(cs_addrs) VARLSTCNT(6) ERR_DBBADFREEBLKCTR, 4, DB_LEN_STR(gv_cur_region),
&(cs_addrs->ti->free_blocks), &free_blocks);
cs_addrs->ti->free_blocks = free_blocks;
Expand Down
14 changes: 14 additions & 0 deletions sr_port/dse_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright (c) 2001-2021 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
Expand Down Expand Up @@ -56,6 +59,10 @@ GBLREF short crash_count;
GBLREF srch_hist dummy_hist;
GBLREF uint4 update_array_size;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

error_def(ERR_DBRDONLY);
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEFAIL);
Expand Down Expand Up @@ -120,6 +127,13 @@ void dse_maps(void)
dse_m_rest(blk, bml_list, bml_size, &csa->ti->free_blocks, TRUE);
for (blk_index = 0, bml_index = 0; blk_index < total_blks; blk_index += bplmap, bml_index++)
{
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP == blk_index))
{
bml_index += (ydb_skip_bml_num - blk_index) / BLKS_PER_LMAP;
blk_index = ydb_skip_bml_num;
}
# endif
t_begin_crit(ERR_DSEFAIL);
CHECK_TN(csa, csd, csd->trans_hist.curr_tn); /* can issue rts_error TNTOOLARGE */
CWS_RESET;
Expand Down
11 changes: 11 additions & 0 deletions sr_port/dse_range.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ GBLREF short int patch_path_count;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF VSIG_ATOMIC_T util_interrupt;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

error_def(ERR_CTRLC);
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEINVALBLKID);
Expand Down Expand Up @@ -103,6 +107,13 @@ void dse_range(void)
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
for (blk = from; blk <= to ;blk++)
{
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP <= blk) && (blk < ydb_skip_bml_num))
{
blk = ydb_skip_bml_num - 1;
continue;
}
# endif
if (util_interrupt)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
Expand Down
3 changes: 3 additions & 0 deletions sr_port/gbldefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,3 +1419,6 @@ GBLDEF boolean_t ydb_treat_sigusr2_like_sigusr1; /* set based on env var "ydb_tr
GBLDEF int jobinterrupt_sig_num; /* Set to signal number that caused $ZINTERRUPT (SIGUSR1/SIGUSR2).
* Used to derive the value of the ISV $ZYINTRSIG.
*/
#ifdef DEBUG
GBLDEF block_id ydb_skip_bml_num; /* See comment in "sr_port/gtm_env_init.c" for purpose */
#endif
18 changes: 17 additions & 1 deletion sr_port/gtm_env_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2020 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2017-2022 YottaDB LLC and/or its subsidiaries. *
* Copyright (c) 2017-2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
Expand Down Expand Up @@ -87,6 +87,10 @@ GBLREF int ydb_repl_filter_timeout;/* # of seconds that source server waits bef
GBLREF boolean_t dollar_test_default; /* Default value taken by dollar_truth via dollar_test_default */
GBLREF boolean_t gtm_nofflf; /* Used to control "write #" behavior ref GTM-9136 */

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

void gtm_env_init(void)
{
boolean_t ret, is_defined;
Expand Down Expand Up @@ -223,6 +227,18 @@ void gtm_env_init(void)
ret = ydb_logical_truth_value(YDBENVINDX_DIRTREE_COLLHDR_ALWAYS, FALSE, &is_defined);
if (is_defined)
TREF(ydb_dirtree_collhdr_always) = ret; /* if logical is not defined, the TREF takes the default value */
/* ydb_test_4g_db_blks env var. If set to a non-zero value of N, it implies blocks from the 1st local bitmap
* to the N-1th local bitmap block are not allocated in the db file. After the 0th local bitmap block, the
* Nth local bitmap block is where block allocation continues. This helps test records in the database blocks
* that contain 8-byte block numbers where the higher order 4-byte is non-zero. This effectively tests all
* code (mostly added in GT.M V7.0-000 and merged into YottaDB r2.00) that handles 8-byte block numbers.
* A 0 value implies this scheme is disabled.
*/
ydb_skip_bml_num = (block_id)ydb_trans_numeric(YDBENVINDX_TEST_4G_DB_BLKS, &is_defined, IGNORE_ERRORS_TRUE, NULL);
if (!is_defined)
ydb_skip_bml_num = 0;
else
ydb_skip_bml_num *= BLKS_PER_LMAP;
# endif
/* GDS Block certification */
ret = ydb_logical_truth_value(YDBENVINDX_GDSCERT, FALSE, &is_defined);
Expand Down
2 changes: 1 addition & 1 deletion sr_port/mu_int_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ GBLREF gtm_uint64_t mu_int_cum[CUM_TYPE_MAX][MAX_BT_DEPTH + 1];
GBLREF uint4 mu_int_offset[];
GBLREF uint4 mu_int_errknt;
GBLREF block_id mu_int_path[];
GBLREF int4 mu_int_blks_to_upgrd;
GBLREF block_id mu_int_blks_to_upgrd;
GBLREF global_list *trees;
GBLREF global_list *trees_tail;
GBLREF gv_key *mu_end_key;
Expand Down
12 changes: 11 additions & 1 deletion sr_port/mu_int_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2001-2018 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2019-2022 YottaDB LLC and/or its subsidiaries. *
* Copyright (c) 2019-2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
Expand Down Expand Up @@ -91,6 +91,11 @@ boolean_t mu_int_init(void)
fc->op = FC_READ;
/* Do aligned reads if opened with O_DIRECT */
udi = FC2UDI(fc);
# ifdef DEBUG
udi->s_addrs.hdr = NULL; /* Clear previous value of udi->s_addrs.hdr as it would have been freed up
* inside STANDALONE macro invoked above.
*/
# endif
tsd = udi->fd_opened_with_o_direct ? (sgmnt_data_ptr_t)(TREF(dio_buff)).aligned : &mu_int_data;
fc->op_buff = (uchar_ptr_t)tsd;
fc->op_len = SGMNT_HDR_LEN;
Expand All @@ -99,6 +104,11 @@ boolean_t mu_int_init(void)
/* Ensure "mu_int_data" is populated even if we did not directly read into it for the O_DIRECT case */
if (udi->fd_opened_with_o_direct)
memcpy(&mu_int_data, (TREF(dio_buff)).aligned, SGMNT_HDR_LEN);
# ifdef DEBUG
udi->s_addrs.hdr = &mu_int_data; /* Now that we have read in the file header, point udi to it for the next dbfilop.
* This is used by the DB_LSEEKREAD macro if "ydb_skip_bml_num" is non-zero.
*/
# endif
if (MASTER_MAP_SIZE_MAX < MASTER_MAP_SIZE(&mu_int_data) ||
native_size < DIVIDE_ROUND_UP(SGMNT_HDR_LEN + MASTER_MAP_SIZE(&mu_int_data), DISK_BLOCK_SIZE) + MIN_DB_BLOCKS)
{
Expand Down
12 changes: 10 additions & 2 deletions sr_port/mu_int_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2001-2020 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2022 YottaDB LLC and/or its subsidiaries. *
* Copyright (c) 2022-2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
Expand Down Expand Up @@ -43,7 +43,7 @@ GBLREF sgmnt_data mu_int_data;
GBLREF block_id mu_int_path[];
GBLREF boolean_t tn_reset_this_reg;
GBLREF int mu_int_plen;
GBLREF int4 mu_int_blks_to_upgrd;
GBLREF block_id mu_int_blks_to_upgrd;
GBLREF int disp_map_errors;
GBLREF int mu_map_errs;
GBLREF int disp_trans_errors;
Expand All @@ -54,6 +54,10 @@ GBLREF sgmnt_addrs *cs_addrs;

GBLREF trans_num largest_tn;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

error_def(ERR_DBREADBM);
error_def(ERR_DBLVLINC);
error_def(ERR_DBMBSIZMN);
Expand Down Expand Up @@ -119,6 +123,10 @@ void mu_int_maps(void)
{
assert(mapsize == mu_int_data.bplmap);
blkno = mcnt * mu_int_data.bplmap;
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (0 < blkno) && (blkno < ydb_skip_bml_num))
continue;
# endif
bml_busy(0, mu_int_locals + ((blkno * BML_BITS_PER_BLK) / BITS_PER_UCHAR));
blk_base = mu_int_read(blkno, &ondsk_blkver, &free_blk_base); /* ondsk_blkver set to GDSV4 or GDSV6 (GDSVCURR) */
if (!blk_base)
Expand Down
13 changes: 12 additions & 1 deletion sr_port/mu_reorg_upgrd_dwngrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2005-2021 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2018-2020 YottaDB LLC and/or its subsidiaries. *
* Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
Expand Down Expand Up @@ -89,6 +89,10 @@ GBLREF unsigned char cw_set_depth;
GBLREF unsigned char cw_map_depth;
GBLREF uint4 update_trans;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

error_def(ERR_BUFFLUFAILED);
error_def(ERR_DBBTUWRNG);
error_def(ERR_DBFILERR);
Expand Down Expand Up @@ -328,6 +332,13 @@ void mu_reorg_upgrd_dwngrd(void)
memset(&reorg_stats, 0, SIZEOF(reorg_stats)); /* initialize statistics for this region */
for (curbmp = start_bmp; curbmp <= last_bmp; curbmp += BLKS_PER_LMAP)
{
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP <= curbmp) && (curbmp < ydb_skip_bml_num))
{
curbmp = ydb_skip_bml_num - BLKS_PER_LMAP;
continue;
}
# endif
if (mu_ctrly_occurred || mu_ctrlc_occurred)
{
status1 = ERR_MUNOFINISH;
Expand Down
14 changes: 14 additions & 0 deletions sr_port/mu_swap_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright (c) 2001-2020 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* Copyright (c) 2023 YottaDB LLC and/or its subsidiaries. *
* All rights reserved. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
Expand Down Expand Up @@ -79,6 +82,10 @@ GBLREF unsigned int t_tries;
GBLREF gv_key *gv_currkey;
GBLREF hash_table_int8 cw_stagnate;

#ifdef DEBUG
GBLREF block_id ydb_skip_bml_num;
#endif

/******************************************************************************************
Input Parameters:
level: level of working block
Expand Down Expand Up @@ -147,6 +154,13 @@ enum cdb_sc mu_swap_blk(int level, block_id *pdest_blk_id, kill_set *kill_set_pt
{
blk_was_free = FALSE;
INCR_BLK_NUM(dest_blk_id);
# ifdef DEBUG
if ((0 != ydb_skip_bml_num) && (BLKS_PER_LMAP < dest_blk_id) && (dest_blk_id < ydb_skip_bml_num))
{
dest_blk_id = ydb_skip_bml_num;
continue;
}
# endif
/* A Pre-order traversal should not cause a child block to go to its parent.
* However, in case it happens because already the organization was like that or for any other reason, skip swap.
* If we decide to swap, code below should be changed to take care of the special case.
Expand Down
Loading

0 comments on commit ea9950a

Please sign in to comment.