Skip to content

Commit aaddf60

Browse files
committed
remove useless assertion
the replication index is now stored in the footer
1 parent ce0bd7a commit aaddf60

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

libsql-wal/src/shared_wal.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,6 @@ impl<IO: Io> SharedWal<IO> {
243243
}
244244
}
245245

246-
// The replication index from page 1 must match that of the SharedWal
247-
#[cfg(debug_assertions)]
248-
{
249-
use libsql_sys::ffi::Sqlite3DbHeader;
250-
use zerocopy::FromBytes;
251-
252-
if page_no == 1 {
253-
let header = Sqlite3DbHeader::read_from_prefix(buffer).unwrap();
254-
assert_eq!(
255-
header.replication_index.get(),
256-
self.checkpointed_frame_no.load(Ordering::Relaxed)
257-
);
258-
}
259-
}
260-
261246
tx.pages_read += 1;
262247

263248
Ok(())

libsql-wal/src/storage/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl Storage for NoStorage {
266266
#[doc(hidden)]
267267
#[derive(Debug)]
268268
pub struct TestStorage<IO = StdIO> {
269-
inner: Arc<Mutex<TestStorageInner<IO>>>,
269+
inner: Arc<async_lock::Mutex<TestStorageInner<IO>>>,
270270
}
271271

272272
#[derive(Debug)]
@@ -323,7 +323,7 @@ impl<IO: Io> Storage for TestStorage<IO> {
323323
_config: Option<Self::Config>,
324324
on_store: OnStoreCallback,
325325
) {
326-
let mut inner = self.inner.lock();
326+
let mut inner = self.inner.lock_blocking();
327327
if inner.store {
328328
let id = uuid::Uuid::new_v4();
329329
let out_path = inner.dir.path().join(id.to_string());
@@ -369,7 +369,7 @@ impl<IO: Io> Storage for TestStorage<IO> {
369369
namespace: &NamespaceName,
370370
_config_override: Option<Self::Config>,
371371
) -> u64 {
372-
let inner = self.inner.lock();
372+
let inner = self.inner.lock_blocking();
373373
if inner.store {
374374
let Some(segs) = inner.stored.get(namespace) else {
375375
return 0;
@@ -386,7 +386,7 @@ impl<IO: Io> Storage for TestStorage<IO> {
386386
frame_no: u64,
387387
_config_override: Option<Self::Config>,
388388
) -> Result<SegmentKey> {
389-
let inner = self.inner.lock();
389+
let inner = self.inner.lock().await;
390390
if inner.store {
391391
if let Some(segs) = inner.stored.get(namespace) {
392392
let Some((key, _path)) = segs.iter().find(|(k, _)| k.includes(frame_no)) else {
@@ -407,7 +407,7 @@ impl<IO: Io> Storage for TestStorage<IO> {
407407
key: &SegmentKey,
408408
_config_override: Option<Self::Config>,
409409
) -> Result<Map<Arc<[u8]>>> {
410-
let inner = self.inner.lock();
410+
let inner = self.inner.lock().await;
411411
if inner.store {
412412
match inner.stored.get(namespace) {
413413
Some(segs) => Ok(segs.get(&key).unwrap().1.clone()),
@@ -424,7 +424,7 @@ impl<IO: Io> Storage for TestStorage<IO> {
424424
key: &SegmentKey,
425425
_config_override: Option<Self::Config>,
426426
) -> Result<CompactedSegment<impl FileExt>> {
427-
let inner = self.inner.lock();
427+
let inner = self.inner.lock().await;
428428
if inner.store {
429429
match inner.stored.get(namespace) {
430430
Some(segs) => {

0 commit comments

Comments
 (0)