[space-maps/core] rewrite the core space map to use less memory.
This commit is contained in:
@@ -87,7 +87,7 @@ namespace {
|
||||
transaction_manager::ptr
|
||||
create_tm() {
|
||||
block_manager::ptr bm = create_bm(NR_BLOCKS);
|
||||
space_map::ptr sm(new core_map(NR_BLOCKS));
|
||||
space_map::ptr sm{create_core_map(NR_BLOCKS)};
|
||||
transaction_manager::ptr tm(new transaction_manager(bm, sm));
|
||||
return tm;
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ namespace {
|
||||
public:
|
||||
ArrayTests()
|
||||
: bm_(new block_manager("./test.data", NR_BLOCKS, 4, block_manager::READ_WRITE)),
|
||||
sm_(new core_map(NR_BLOCKS)),
|
||||
sm_(create_core_map(NR_BLOCKS)),
|
||||
tm_(bm_, sm_) {
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ namespace {
|
||||
public:
|
||||
BitsetTests()
|
||||
: bm_(new block_manager("./test.data", NR_BLOCKS, 4, block_manager::READ_WRITE)),
|
||||
sm_(new core_map(NR_BLOCKS)),
|
||||
sm_(create_core_map(NR_BLOCKS)),
|
||||
tm_(bm_, sm_) {
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ namespace {
|
||||
|
||||
private:
|
||||
space_map::ptr setup_core_map() {
|
||||
space_map::ptr sm(new core_map(NR_BLOCKS));
|
||||
space_map::ptr sm(create_core_map(NR_BLOCKS));
|
||||
sm->inc(SUPERBLOCK);
|
||||
return sm;
|
||||
}
|
||||
|
@@ -302,7 +302,7 @@ namespace {
|
||||
|
||||
private:
|
||||
space_map::ptr setup_core_map() {
|
||||
space_map::ptr sm(new core_map(NR_BLOCKS));
|
||||
space_map::ptr sm(create_core_map(NR_BLOCKS));
|
||||
sm->inc(SUPERBLOCK);
|
||||
return sm;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ namespace {
|
||||
public:
|
||||
BtreeTests()
|
||||
: bm_(new block_manager("./test.data", NR_BLOCKS, 4, block_manager::READ_WRITE)),
|
||||
sm_(new core_map(NR_BLOCKS)),
|
||||
sm_(create_core_map(NR_BLOCKS)),
|
||||
tm_(bm_, sm_) {
|
||||
}
|
||||
|
||||
|
@@ -37,14 +37,14 @@ namespace {
|
||||
public:
|
||||
SpaceMapTests()
|
||||
: bm_(new block_manager("./test.data", NR_BLOCKS, MAX_LOCKS, block_manager::READ_WRITE)),
|
||||
sm_(new core_map(NR_BLOCKS)),
|
||||
sm_(create_core_map(NR_BLOCKS)),
|
||||
tm_(bm_, sm_) {
|
||||
}
|
||||
|
||||
struct sm_core_creator {
|
||||
static space_map::ptr
|
||||
create(transaction_manager &tm) {
|
||||
return space_map::ptr(new persistent_data::core_map(NR_BLOCKS));
|
||||
return create_core_map(NR_BLOCKS);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace {
|
||||
static space_map::ptr
|
||||
create(transaction_manager &tm) {
|
||||
return create_careful_alloc_sm(
|
||||
checked_space_map::ptr(
|
||||
new core_map(NR_BLOCKS)));
|
||||
create_core_map(NR_BLOCKS));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -61,8 +60,7 @@ namespace {
|
||||
static checked_space_map::ptr
|
||||
create(transaction_manager &tm) {
|
||||
return create_recursive_sm(
|
||||
checked_space_map::ptr(
|
||||
new core_map(NR_BLOCKS)));
|
||||
create_core_map(NR_BLOCKS));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -279,7 +277,7 @@ TEST_F(SpaceMapTests, test_metadata_and_disk)
|
||||
{
|
||||
block_manager::ptr bm(
|
||||
new block_manager("./test.data", NR_BLOCKS, MAX_LOCKS, block_manager::READ_WRITE));
|
||||
space_map::ptr core_sm(new core_map(NR_BLOCKS));
|
||||
space_map::ptr core_sm{create_core_map(NR_BLOCKS)};
|
||||
transaction_manager::ptr tm(new transaction_manager(bm, core_sm));
|
||||
persistent_space_map::ptr metadata_sm = persistent_data::create_metadata_sm(*tm, NR_BLOCKS);
|
||||
copy_space_maps(metadata_sm, core_sm);
|
||||
|
@@ -21,7 +21,7 @@ void test::zero_block(block_manager::ptr bm, block_address b)
|
||||
transaction_manager::ptr
|
||||
test::open_temporary_tm(block_manager::ptr bm)
|
||||
{
|
||||
space_map::ptr sm(new core_map(bm->get_nr_blocks()));
|
||||
space_map::ptr sm{create_core_map(bm->get_nr_blocks())};
|
||||
transaction_manager::ptr tm(new transaction_manager(bm, sm));
|
||||
return tm;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ namespace {
|
||||
create_tm() {
|
||||
block_manager::ptr bm(
|
||||
new block_manager("./test.data", NR_BLOCKS, MAX_HELD_LOCKS, block_manager::READ_WRITE));
|
||||
space_map::ptr sm(new core_map(NR_BLOCKS));
|
||||
space_map::ptr sm{create_core_map(NR_BLOCKS)};
|
||||
transaction_manager::ptr tm(new transaction_manager(bm, sm));
|
||||
tm->get_sm()->inc(0);
|
||||
return tm;
|
||||
|
Reference in New Issue
Block a user