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