Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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_py/_lbug_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def __init__(
max_num_threads: int = 0,
compression: bool = True,
read_only: bool = False,
max_db_size: int = (1 << 30),
max_db_size: int = 0xFFFFFFFF,
Comment thread
adsharma marked this conversation as resolved.
Outdated
auto_checkpoint: bool = True,
checkpoint_threshold: int = -1,
throw_on_wal_replay_failure: bool = True,
Expand Down
2 changes: 1 addition & 1 deletion src_py/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
compression: bool = True,
lazy_init: bool = False,
read_only: bool = False,
max_db_size: int = (1 << 30),
max_db_size: int = 0xFFFFFFFF,
auto_checkpoint: bool = True,
checkpoint_threshold: int = -1,
throw_on_wal_replay_failure: bool = True,
Expand Down
10 changes: 9 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def init_movie_serial(conn: lb.Connection) -> None:


_POOL_SIZE_: int = 256 * 1024 * 1024
# Use 1GB max DB size for tests to avoid exhausting virtual address space
# when many databases are open simultaneously (CI runners may have tight VA limits)
_MAX_DB_SIZE_: int = 1 << 30
Comment thread
aheev marked this conversation as resolved.


def get_db_file_path(tmp_path: Path) -> Path:
Expand Down Expand Up @@ -228,7 +231,12 @@ def _close_cached_readonly_state() -> None:

def create_conn_db(path: Path, *, read_only: bool) -> ConnDB:
"""Return a new connection and database."""
db = lb.Database(path, buffer_pool_size=_POOL_SIZE_, read_only=read_only)
db = lb.Database(
path,
buffer_pool_size=_POOL_SIZE_,
read_only=read_only,
max_db_size=_MAX_DB_SIZE_,
)
conn = lb.Connection(db, num_threads=4)
return conn, db

Expand Down
6 changes: 4 additions & 2 deletions test/test_mvcc_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@ def run_bank_test(
edges = build_edges(N_ACCOUNTS, EDGE_PROB, rng)

try:
db = lb.Database(str(db_path), enable_multi_writes=enable_multi_writes)
db = lb.Database(
str(db_path), enable_multi_writes=enable_multi_writes, max_db_size=1 << 30
)
except TypeError:
# Fallback if binding patch is not applied
db = lb.Database(str(db_path))
db = lb.Database(str(db_path), max_db_size=1 << 30)

setup_db(db, N_ACCOUNTS, edges)

Expand Down
6 changes: 3 additions & 3 deletions test/test_wal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def run_query_in_new_process(tmp_path: Path, build_dir: Path, queries: str):
sys.path.append(r"{build_dir!s}")

import ladybug as lb
db = lb.Database(r"{db_path!s}")
db = lb.Database(r"{db_path!s}", max_db_size=1 << 30)
Comment thread
aheev marked this conversation as resolved.
Outdated
""") + queries
return subprocess.Popen([sys.executable, "-c", code])

Expand All @@ -40,7 +40,7 @@ def test_replay_after_kill(tmp_path: Path, build_dir: Path) -> None:
""")
run_query_then_kill(tmp_path, build_dir, queries)
db_path = get_db_file_path(tmp_path)
with lb.Database(db_path) as db, lb.Connection(db) as conn:
with lb.Database(db_path, max_db_size=1 << 30) as db, lb.Connection(db) as conn:
# previously committed queries should be valid after replaying WAL
result = conn.execute("CALL show_tables() RETURN *")
assert result.has_next()
Expand All @@ -64,7 +64,7 @@ def test_replay_with_exception(tmp_path: Path, build_dir: Path) -> None:
""")
run_query_then_kill(tmp_path, build_dir, queries)
db_path = get_db_file_path(tmp_path)
with lb.Database(db_path) as db, lb.Connection(db) as conn:
with lb.Database(db_path, max_db_size=1 << 30) as db, lb.Connection(db) as conn:
# previously committed queries should be valid after replaying WAL
result = conn.execute("match (t:tab) where t.id <= 5 return t.id")
assert result.get_num_tuples() == 5
Expand Down
Loading