Skip to content
Draft
Changes from all 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
44 changes: 36 additions & 8 deletions engine/packages/pegboard-envoy/src/ws_to_tunnel_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,25 @@
match handle_sqlite_get_pages(ctx, conn, request).await {
Ok(response) => response,
Err(err) => {
tracing::error!(
actor_id = %actor_id,
?pgnos,
?expected_generation,
?expected_head_txid,
?err,
"sqlite get_pages request failed"
);
if is_initial_sqlite_database_missing(&pgnos, expected_head_txid, &err) {
tracing::debug!(
actor_id = %actor_id,
?pgnos,
?expected_generation,
?expected_head_txid,
?err,
"sqlite get_pages request found no persisted database during bootstrap"
);
} else {
tracing::error!(
actor_id = %actor_id,
?pgnos,
?expected_generation,
?expected_head_txid,
?err,
"sqlite get_pages request failed"
);
}
protocol::SqliteGetPagesResponse::SqliteErrorResponse(sqlite_error_response(&err))
}
}
Expand Down Expand Up @@ -1115,6 +1126,23 @@
.find_map(|source| source.downcast_ref::<SqliteStorageError>())
}

fn is_initial_sqlite_database_missing(
pgnos: &[u32],
expected_head_txid: Option<u64>,
err: &anyhow::Error,
) -> bool {
// SQLite page 1 is the database header. On a fresh actor DB, Depot has no
// database branch until the first commit creates it, so the local VFS treats
// exactly this missing page as empty-database bootstrap.
pgnos == [1]
&& expected_head_txid.is_none()
&& matches!(

Check warning on line 1139 in engine/packages/pegboard-envoy/src/ws_to_tunnel_task.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

Diff in /home/runner/work/rivet/rivet/engine/packages/pegboard-envoy/src/ws_to_tunnel_task.rs
depot_error(err),
Some(SqliteStorageError::DatabaseNotFound)
| Some(SqliteStorageError::MetaMissing { operation: "get_pages" })
)
}

fn sqlite_error_reason(err: &anyhow::Error) -> String {
err.chain()
.map(ToString::to_string)
Expand Down
Loading