Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 1129 #1153

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/storage/wal/wal.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class WAL : public BaseWALAndWALIterator {

class WALIterator : public BaseWALAndWALIterator {
public:
explicit WALIterator(shared_ptr<FileHandle> fileHandle, mutex& mtx);
explicit WALIterator(const shared_ptr<FileHandle>& fileHandle, mutex& mtx);

inline bool hasNextRecord() {
lock_t lck{mtx};
Expand Down
2 changes: 1 addition & 1 deletion src/storage/wal/wal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void WAL::setIsLastRecordCommit() {
}
}

WALIterator::WALIterator(shared_ptr<FileHandle> fileHandle, mutex& mtx)
WALIterator::WALIterator(const shared_ptr<FileHandle>& fileHandle, mutex& mtx)
: BaseWALAndWALIterator(fileHandle), mtx{mtx} {
resetCurrentHeaderPagePrefix();
if (fileHandle->getNumPages() > 0) {
Expand Down
4 changes: 2 additions & 2 deletions test/include/main_test_helper/main_test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace kuzu {
namespace testing {

class ApiTest : public EmptyDBTest {
class ApiTest : public BaseGraphTest {

public:
void SetUp() override {
EmptyDBTest::SetUp();
BaseGraphTest::SetUp();
systemConfig->defaultPageBufferPoolSize = (1ull << 26);
systemConfig->largePageBufferPoolSize = (1ull << 26);
createDBAndConn();
Expand Down
3 changes: 3 additions & 0 deletions test/include/test_helper/test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class BaseGraphTest : public Test {
void TearDown() override { FileUtils::removeDir(TestHelper::getTmpTestDir()); }

inline void createDBAndConn() {
if (database != nullptr) {
database.reset();
}
database = make_unique<Database>(*databaseConfig, *systemConfig);
conn = make_unique<Connection>(database.get());
spdlog::set_level(spdlog::level::info);
Expand Down
13 changes: 5 additions & 8 deletions test/main/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
using namespace kuzu::testing;

TEST_F(ApiTest, DatabaseConfig) {
auto db = make_unique<Database>(DatabaseConfig(TestHelper::getTmpTestDir()));
spdlog::set_level(spdlog::level::debug);
ASSERT_NO_THROW(db->resizeBufferManager(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2));
ASSERT_EQ(getDefaultBMSize(*db), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 *
StorageConfig::DEFAULT_PAGES_BUFFER_RATIO));
ASSERT_EQ(getLargeBMSize(*db), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 *
StorageConfig::LARGE_PAGES_BUFFER_RATIO));
ASSERT_NO_THROW(database->resizeBufferManager(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2));
ASSERT_EQ(getDefaultBMSize(*database), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 *
StorageConfig::DEFAULT_PAGES_BUFFER_RATIO));
ASSERT_EQ(getLargeBMSize(*database), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 *
StorageConfig::LARGE_PAGES_BUFFER_RATIO));
}

TEST_F(ApiTest, ClientConfig) {
auto db = make_unique<Database>(DatabaseConfig(TestHelper::getTmpTestDir()));
spdlog::set_level(spdlog::level::debug);
auto conn = make_unique<Connection>(db.get());
ASSERT_NO_THROW(conn->setMaxNumThreadForExec(2));
ASSERT_EQ(conn->getMaxNumThreadForExec(), 2);
}
Expand Down