Skip to content

Commit

Permalink
Merge pull request #1754 from tursodatabase/libsql-wal-fixes
Browse files Browse the repository at this point in the history
libsql wal fixes
  • Loading branch information
MarinPostma authored Sep 23, 2024
2 parents 5cfdd70 + 39a6973 commit f711cfa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion libsql-server/src/connection/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ where
ctx: RequestContext,
builder: B,
) -> Result<B> {
let config = self.inner.lock().config();
let inner = self.inner.clone();
let config = tokio::task::spawn_blocking(move || inner.lock().config())
.await
.unwrap();
check_program_auth(&ctx, &pgm, &config).await?;
let conn = self.inner.clone();
CoreConnection::run_async(conn, pgm, builder).await
Expand Down
5 changes: 4 additions & 1 deletion libsql-server/src/connection/libsql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ impl LibsqlConnection {
ctx: RequestContext,
builder: B,
) -> Result<B> {
let config = self.inner.lock().config();
let inner = self.inner.clone();
let config = tokio::task::spawn_blocking(move || inner.lock().config())
.await
.unwrap();
check_program_auth(&ctx, &pgm, &config).await?;
let conn = self.inner.clone();
CoreConnection::run_async(conn, pgm, builder).await
Expand Down
4 changes: 2 additions & 2 deletions libsql-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ type MakeReplicationSvc = Box<
// static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[global_allocator]
static GLOBAL: rheaper::Allocator<mimalloc::MiMalloc> =
rheaper::Allocator::from_allocator(mimalloc::MiMalloc);
static GLOBAL: rheaper::Allocator<std::alloc::System> =
rheaper::Allocator::from_allocator(std::alloc::System);

#[derive(clap::ValueEnum, PartialEq, Clone, Copy, Debug)]
pub enum CustomWAL {
Expand Down
2 changes: 1 addition & 1 deletion libsql-wal/src/segment/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ impl SegmentIndex {
offsets
.iter()
.rev()
.find(|fno| **fno as u64 <= max_offset)
.find(|fno| (**fno as u64) < max_offset)
.copied()
}

Expand Down

0 comments on commit f711cfa

Please sign in to comment.