core: Switch RwLock<Arc<Pager>> to ArcSwap<Pager>

We don't actually need the RwLock locking capabilities, just the ability
to swap the instance.
This commit is contained in:
Pekka Enberg
2025-10-23 13:18:07 +03:00
parent 418fc90f8a
commit c3fb867173
13 changed files with 171 additions and 162 deletions

View File

@@ -65,7 +65,7 @@ mod tests {
let conn = db.get_db().connect().unwrap();
let mvcc_store = db.get_db().mv_store.as_ref().unwrap().clone();
for _ in 0..iterations {
let tx = mvcc_store.begin_tx(conn.pager.read().clone()).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.load().clone()).unwrap();
let id = IDS.fetch_add(1, Ordering::SeqCst);
let id = RowID {
table_id: (-2).into(),
@@ -74,7 +74,7 @@ mod tests {
let row = generate_simple_string_row((-2).into(), id.row_id, "Hello");
mvcc_store.insert(tx, row.clone()).unwrap();
commit_tx_no_conn(&db, tx, &conn).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.read().clone()).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.load().clone()).unwrap();
let committed_row = mvcc_store.read(tx, id).unwrap();
commit_tx_no_conn(&db, tx, &conn).unwrap();
assert_eq!(committed_row, Some(row));
@@ -86,7 +86,7 @@ mod tests {
let conn = db.get_db().connect().unwrap();
let mvcc_store = db.get_db().mv_store.as_ref().unwrap().clone();
for _ in 0..iterations {
let tx = mvcc_store.begin_tx(conn.pager.read().clone()).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.load().clone()).unwrap();
let id = IDS.fetch_add(1, Ordering::SeqCst);
let id = RowID {
table_id: (-2).into(),
@@ -95,7 +95,7 @@ mod tests {
let row = generate_simple_string_row((-2).into(), id.row_id, "World");
mvcc_store.insert(tx, row.clone()).unwrap();
commit_tx_no_conn(&db, tx, &conn).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.read().clone()).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.load().clone()).unwrap();
let committed_row = mvcc_store.read(tx, id).unwrap();
commit_tx_no_conn(&db, tx, &conn).unwrap();
assert_eq!(committed_row, Some(row));
@@ -127,7 +127,7 @@ mod tests {
let dropped = mvcc_store.drop_unused_row_versions();
tracing::debug!("garbage collected {dropped} versions");
}
let tx = mvcc_store.begin_tx(conn.pager.read().clone()).unwrap();
let tx = mvcc_store.begin_tx(conn.pager.load().clone()).unwrap();
let id = i % 16;
let id = RowID {
table_id: (-2).into(),