Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma committed Oct 13, 2023
1 parent 7080669 commit 7e4d389
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions sqld/src/replication/replica/injector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ impl Injector {

let connection = self.connection.lock();
// use prepare cached to avoid parsing the same statement over and over again.
let mut stmt = connection.prepare_cached("INSERT INTO libsql_temp_injection VALUES (42)")?;
let mut stmt =
connection.prepare_cached("INSERT INTO libsql_temp_injection VALUES (42)")?;
stmt.execute(())?;
// force call to xframe
match connection.cache_flush() {
Expand All @@ -129,8 +130,9 @@ impl Injector {
if e.extended_code == LIBSQL_INJECT_OK {
// refresh schema
connection.pragma_update(None, "writable_schema", "reset")?;
if let Err(e) = connection.execute("COMMIT", ()) {
if !matches!(e.sqlite_error(), Some(rusqlite::ffi::Error{ extended_code, .. }) if *extended_code == 201) {
if let Err(e) = connection.execute("COMMIT", ()) {
if !matches!(e.sqlite_error(), Some(rusqlite::ffi::Error{ extended_code, .. }) if *extended_code == 201)
{
tracing::error!("injector failed to commit: {e}");
return Err(Error::FatalReplicationError);
}
Expand Down
5 changes: 4 additions & 1 deletion sqld/src/replication/replica/replicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ impl Replicator {
Ok(None) => (),
Err(e @ crate::Error::FatalReplicationError) => {
// we conservatively nuke the replica and start replicating from scractch
tracing::error!("fatal error replicating `{}` from primary, reseting namespace...", self.namespace);
tracing::error!(
"fatal error replicating `{}` from primary, reseting namespace...",
self.namespace
);
(self.reset)(ResetOp::Destroy(self.namespace.clone()));
Err(e)?
}
Expand Down

0 comments on commit 7e4d389

Please sign in to comment.