This commit is contained in:
Gregory Burd 2024-05-17 21:35:45 -04:00
parent 5bd3872153
commit b2a2f0865e

View file

@ -184,7 +184,7 @@ static bool
__sm_release_span(void **handle, pgno_t pg, unsigned len)
{
sparsemap_t **map = (sparsemap_t **)handle;
for (pgno_t i = pg; i <= len; i++) {
for (pgno_t i = pg; i < pg + len; i++) {
assert(_sparsemap_set(map, i, true) == i);
}
return true;
@ -307,7 +307,7 @@ __midl_is_set(void *handle, pgno_t pg)
static pgno_t
__midl_clear(void **handle, pgno_t pg)
{
MDB_IDL list = (MDB_IDL *)*handle;
MDB_IDL list = *(MDB_IDL *)handle;
unsigned len = list[0];
list[0] = len -= 1;
for (unsigned j = pg - 1; j < len;)
@ -348,8 +348,8 @@ search_done:;
static bool
__midl_take_span(void **handle, pgno_t pg, unsigned len)
{
MDB_IDL list = (MDB_IDL *)*handle;
int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg) + len;
MDB_IDL list = *(MDB_IDL *)handle;
int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg);
unsigned j, num = len;
pgno_t *mop = list;
unsigned mop_len = mop[0];
@ -827,7 +827,7 @@ main(int argc, char *argv[])
// Check if record file is specified
if (record_file == NULL) {
recording = true; // TODO false
recording = true;//TODO
} else {
// Check for existing file without force flag
if (access(record_file, F_OK) == 0 && !force_flag) {
@ -925,11 +925,12 @@ main(int argc, char *argv[])
} while (amt - left > amt / 100);
}
if (toss(1000) == 0) {
size_t new_amt;
if (toss(1000) > 800) {
size_t new_offset, new_amt;
pgno_t max;
larger_please:
new_amt = 1024 + (xorshift32() % 2048) + toss(1024);
new_offset = xorshift32() % 4096 + 1024;
max = sparsemap_get_ending_offset(handles[SM]);
// Build a new container to merge with the existing one.
@ -939,9 +940,9 @@ main(int argc, char *argv[])
for (size_t i = 0; i < new_amt; i++) {
// We don't want to record and we're using new_handles not
// handles, so call fn directly.
assert(containers[type].is_set(new_handles[type], i) == false);
containers[type].set(&new_handles[type], i);
assert(containers[type].is_set(new_handles[type], i) == true);
assert(containers[type].is_set(new_handles[type], i + new_offset) == false);
containers[type].set(&new_handles[type], i + new_offset);
assert(containers[type].is_set(new_handles[type], i + new_offset) == true);
}
}
foreach(types)