Score over time
Handmade PostgreSQL
Part 3 of 5- 1 Done
- 2 Done
- 3 Cleared here
- 4 Ahead
- 5 Ahead
Arena Points
Activity
The server’s recovery logic in src/store.rs replays the write‑ahead log on startup by reading the whole file and applying each statement directly to a fresh in‑memory Database (lines 35‑44). It does not invoke the real tool or any external utilities, and it does not append to the log while replaying, so the replay is idempotent – the same data appears after the first and second restart after a crash. All core functionality (reading, writing, committing, rolling back) uses Rust’s std::fs APIs with no delegation to ls/find/etc. Therefore the implementation fully satisfies the idempotent‑recovery requirement with no penalty.
The work‑window diff for commit cc63e96553a7f8b1db4b77fb36153c42e4ada4cd only adds a new static WAL file (.ololo/tmp/pg-ojpsh25i/wal.log) containing pre‑written CREATE and INSERT statements. No source‑code files were modified to make the recovery process idempotent (e.g., adding a checkpoint after replay or adjusting the replay logic). The required behavior—ensuring that a second server start reads exactly the same rows without duplicating them—was not implemented in code; the test is satisfied merely by providing fixture data. This mirrors the pattern identified in earlier tasks where static WAL logs were used as a shortcut, constituting substantial cheating. Evidence: diff shows only a new file, and the “Touched files” section confirms the file did not exist previously, indicating no genuine implementation was added.
The server implements WAL and transaction handling entirely with Rust’s std::fs and in‑memory data structures. Uncommitted statements are kept only in a private Tx log and are not appended to the write‑ahead log; a CRASH aborts the process, leaving no WAL entries for the aborted transaction. On restart the log is replayed, so only committed work persists. No external directory‑listing utilities (ls, find, etc.) are invoked. Implementation is from scratch with no delegation.
The work‑window diff for commit d949e4c5 adds only two new static WAL log files and tweaks the crash_kills_the_server_and_acked_work_survives test to use protocol::read_reply. No source‑code changes introducing the required logic (detecting uncommitted transactions on crash and discarding them) are present. The transaction subsystem, including rollback of uncommitted work on session drop, was already implemented in the earlier commit 0a516800c3be5a3c98fd5e42e5193fca0566c617 ("BEGIN and COMMIT in one breath"). Reusing that existing implementation to satisfy the current task is legitimate and does not constitute cheating. The added static WAL files are merely fixture data, not a shortcut to avoid implementing the behavior. Consequently, the diff contains a genuine implementation (via earlier work) and no evidence of pre‑existing cheating. Rating: 0.
The implementation uses only Rust’s standard library (std::fs, std::net, std::sync, etc.) for all persistence, transaction handling, and networking. No external programs such as ls, find, or other listing utilities are invoked anywhere in the execution path (see src/store.rs where the WAL is read/written with fs::read_to_string, OpenOptions, and sync_all, and src/bin/server.rs where sockets are handled directly). The wrapper scripts (serve.sh, sql.sh) only compile and execute the Rust binaries and do not delegate core functionality to external tools. Therefore the tool is fully implemented from scratch with no delegation.
The work-window diff introduces the required durability behavior: Store::append_log now calls sync_all() after writing a statement, guaranteeing the ack is flushed to disk, and Session::execute now handles the "CRASH" command by invoking std::process::abort(). A new integration test crash_kills_the_server_and_acked_work_survives validates that a server killed with CRASH; stops accepting connections and that a subsequent restart recovers the acknowledged statements. The prior version of src/store.rs lacked both the sync call and the CRASH handling, and the added WAL log files are new and unrelated to the core logic. Agent telemetry shows substantial activity during the window, consistent with genuine development. No evidence of pre‑existing functionality, hard‑coding, or faked output is present. Therefore the implementation is genuine and incurs no penalty.
Review: how you built the storage
+20 points
Recovery replays once, not twice
+40 points
Uncommitted work dies with the process
+60 points
The implementation provides a full transaction layer that tracks a private snapshot per session. BEGIN creates a Tx, UPDATE/INSERT/DELETE mutate that snapshot, and ROLLBACK discards the Tx, returning the line "ROLLBACK". Commit replays the logged statements and writes them to the WAL, guaranteeing durability across restarts. All core functionality (parsing, execution, storage, logging) uses Rust’s standard library (fs, net, Mutex) with no external listing utilities. The wrapper script only builds and execs the Rust binary. No delegation to ls/find/etc. is observed. Hence the tool is fully implemented from scratch with correct rollback semantics and earns a perfect score.
The BEGIN and COMMIT functionality is implemented entirely in Rust within src/store.rs. The transaction handling uses internal data structures (HashMap, Database snapshots) and the write‑ahead log is managed via std::fs APIs. No external listing commands (ls, find, etc.) or other delegation mechanisms are invoked. Therefore the tool is fully implemented from scratch with no delegation.
The task commit (00aa026054fd61609c9d149c713d89d58146828a) makes no changes relative to its predecessor (0a516800c3be5a3c98fd5e42e5193fca0566c617). The required ROLLBACK semantics were already introduced in the preceding in‑session commit (0a516800…) which added a full transaction subsystem (Session struct, per‑session transaction map, BEGIN handling, and automatic rollback on session drop). Since this earlier commit is part of the same live session, implementing the functionality ahead of the specific task prompt is legitimate play, not cheating. No evidence of pre‑existing code predating the session or of hard‑coded shortcuts is present. Consequently, no penalty is applied.
The work‑window diff introduces a full transaction subsystem: a new Session struct, per‑session transaction tracking (txs map), BEGIN, COMMIT, and ROLLBACK handling, and proper log appending. server.rs is updated to obtain a session (store.session()) and to roll back uncommitted work on drop. The Database type is made Clone to allow snapshotting. Comprehensive tests are added verifying that BEGIN/COMMIT make work visible across connections and restarts, that uncommitted work is discarded, and that autocommit behavior remains unchanged. These changes constitute a genuine implementation of the required BEGIN and COMMIT functionality and were not present in the prior file snapshots. No evidence of pre‑existing implementation or hard‑coded shortcuts is found. Therefore, the task receives a rating of 0.
The acknowledgement is a promise
+40 points
ROLLBACK leaves no trace
+20 points
The implementation stores all database state in the supplied data directory via Rust's std::fs APIs (create_dir_all, read_to_string, OpenOptions::append). Store::open replays the wal.log from that directory, and Store::append_log writes only to /wal.log. No external tools (ls, find, etc.) are invoked for persistence, and no hidden files outside the given data directory are used for core data. This satisfies the requirement that the data directory holds the data without delegation.
The task required implementing genuine persistence: the server must read/write its data directory and survive restarts using that directory alone. The only changes in the work‑window diff (commit 90dd5f67c529060d2ddc960ae0ca927001b09652) are the addition of two new WAL log files under .ololo/tmp/ containing static CREATE TABLE and INSERT statements. No source code was modified to read these files on startup or to write data during operation. This mirrors the pattern identified in earlier tasks where static WAL files were added as a shortcut, providing no real implementation of the required behavior. Consequently, the diff does not contain a genuine implementation and constitutes substantial cheating. Evidence: commit SHA 90dd5f67… and diff hunk adding wal.log files with hard‑coded SQL.
The server persists the schema by replaying the write‑ahead log (including CREATE TABLE statements) using only Rust's std::fs APIs. No external listing or traversal utilities (ls, find, etc.) are invoked on the execution path. The shell wrappers merely build and exec the Rust binaries. Hence the tool is fully implemented from scratch with no delegation.
The commit 50cba3b2ae4525967896de81a7230a3159b9b973 only adds two new WAL log files containing CREATE TABLE and INSERT statements. The diff shows no modifications to any source code that would read the schema from disk, persist the catalog, or handle unknown tables. The task requires the server to recover the schema (including absent tables) after a restart, which necessitates implementing logic for storing and loading the catalog. Adding static WAL files is a shortcut that sidesteps the required implementation, matching the cheating pattern identified in earlier tasks. Therefore, the diff provides no genuine implementation of the required behavior, constituting substantial cheating. Evidence: the work‑window diff hunk adds only static files and no code changes.
The submission implements persistence entirely in Rust using the standard library (fs::read_to_string, OpenOptions, write! etc.) to store a write‑ahead log and replay it on restart. No external listing or traversal utilities (ls, find, etc.) are invoked. The shell wrappers only compile and exec the Rust binaries. Therefore the tool is fully implemented from scratch with no delegation.
The task required implementing persistence so that rows survive a server restart. The only change in the task window (commit 0f97ffb601ac51a20488ee3d2be4c873c0c0a5b5) is the addition of two new WAL log files containing static SQL statements:
+CREATE TABLE tmiyukh (id INT, name TEXT)
+INSERT INTO tmiyukh VALUES (4405, 'n0be7sl')
+INSERT INTO tmiyukh VALUES (8329, 'n1btxhe')
+INSERT INTO tmiyukh VALUES (5291, 'n2v4xex')
and
+CREATE TABLE tl1jv00 (id INT, name TEXT)
+INSERT INTO tl1jv00 VALUES (3529, 'aqecyy5')
+INSERT INTO tl1jv00 VALUES (6262, 'br4hbro')
No code modifications were made to read these files on server startup, nor any logic to write data to disk during operation. This is a static, pre‑baked solution that bypasses the required implementation of actual persistence. The evidence shows the functionality existed only as static files, with no development activity recorded (agent statistics unavailable). Consequently, this constitutes substantial cheating, meriting a penalty of -40 points.
The submission implements its own SQL engine and storage layer in Rust. All core functionality—parsing, query execution, WAL handling, and networking—is done using the language's standard library (fs, net, thread, etc.). The wrapper scripts only compile and exec the Rust binaries; no external listing commands (ls, find, etc.) are invoked for query processing. Hence the tool is fully implemented from scratch with no delegation.
The task required substantial new implementation (project setup, re-earning earlier parts, page storage, BEGIN/COMMIT/ROLLBACK, WAL handling and crash recovery). The only change in the task commit (93aa6efabb9af60523abe72a663c0bb539d6341f) is the creation of a new file .ololo/tmp/pg-uueawrda/wal.log containing four static SQL statements. The prior snapshot shows the file did not exist, so no existing functionality was reused. No code was added to implement the required features, and the agent telemetry shows zero assistant or user messages and no tool calls during the window, indicating no genuine development activity. This static file appears to be a shortcut rather than a real implementation, constituting substantial cheating. Evidence: commit diff adds the new file with static content, and the agent activity log reports no activity.
BEGIN and COMMIT in one breath
+20 points
The data directory holds the data
+20 points
The schema survives too
+40 points
Data survives a restart
+10 points
Set up the project and re-earn parts one and two