RawPostgres

class RawPostgres(url: String, user: String, password: String)

The raw run on PostgreSQL: Wow's tables cloned (LIKE … INCLUDING ALL: its columns, keys and indexes) as raw_log, raw_snapshot and raw_partition, written with rows of the domain's own commits as templates, by Wow's own statement texts and parameter types:

  • the append, Wow's group commit for one table, across partitions (appendText) or, when the group's streams are of one partition, its one-partition form (appendOneText), as Wow's appender chooses: each stream's version read by the version key, linked to the streams before it, the ones that fit taken, the partitions' counters locked in order and bumped, the rows inserted in key order, each stream's sequence returned; one autocommitted statement;

  • the save, Wow's version-guarded multi-row upsert of rows in key order, returning the keys it wrote (upsertText), one transaction a flush whose bound (bound: synchronous_commit off when asynchronous, and the timeouts Wow sets at its default 30-second operation timeout) is sent with it in one round trip, as Wow sends it.

The texts differ from Wow's only in the clones' table names and, for the append, in naming one table (branch 0) of the several Wow's text can name; the account type's group is that one table in Wow's run too. A stream's partition is Wow's own (Partitioner); its command and request ids are Wow's UUIDv7s. A unit counts only when the store wrote it: an append's returned sequence, an upsert's returned key; the rest are refused.

Constructors

Link copied to clipboard
constructor(url: String, user: String, password: String)

Types

Link copied to clipboard
class Case(val case: RawCase, val fillfactor: Int, val shape: WowShape.Options? = null, val flush: (Connection, Aggregates) -> Flushed)

A case of this store, the snapshot table's fillfactor it runs at, and its flush on a connection; or, with a shape, Wow's own write path (shapeOf) its callers submit to.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The tenant of Wow's rows.

Functions

Link copied to clipboard
fun cases(logBatch: Int, snapshotBatch: Int, rows: List<Int>): List<RawPostgres.Case>

The cases: WOW_TODAY (today's shape: logBatch streams an append, the snapshots behind the appends snapshotBatch a transaction, asynchronously, across appends), the log alone, P0 and P1 (the snapshot upsert alone at each of rows rows a statement, synchronous and asynchronous, at fillfactor 100 and 80), P2 (the append and its snapshots in one synchronous transaction against today's split), Wow's own peak shape (WowShape.cases) and a point read.

Link copied to clipboard

A checkpoint, so what follows writes the first images of the pages it touches.

Link copied to clipboard
Link copied to clipboard

PostgreSQL's cumulative counters (PostgresCounters), and the statements' round trips.

Link copied to clipboard
fun loadTemplates(count: Int)

Up to count rows of each of Wow's tables as templates, each value of its own type, and its partition count.

Link copied to clipboard
fun prepare(fillfactor: Int, aggregates: Int): Boolean

Fresh raw_* tables: cloned from Wow's, the snapshot table at fillfactor, and each of aggregates aggregates opened as Wow's runs open them before they measure: its first stream in the log and its snapshot at version 1, so every write goes on from version 2. The opening streams are history no case measures: they take partitions in turn rather than by Partitioner, and ids of their own. Then analysed, and a checkpoint so each case starts from one.

Link copied to clipboard
fun ratios(growth: Map<String, Double>): Map<String, Double>

The snapshot table's HOT share, from the counters' growth.

Link copied to clipboard
fun records(before: Map<String, Double>, after: Map<String, Double>): Map<String, Double>

The WAL between two counters' reads by record type and table (PostgresCounters).

Link copied to clipboard

case's WAL reader (records): the calibration's alone, which its checks read; over a fast step's window the WAL is millions of records, and reading them for nothing made each such step minutes long.

Link copied to clipboard

The server's version and settings, and Wow's partition count.

Link copied to clipboard

Wow's own write path on this store (options): its appenders' and writers' connections, their calls.

Link copied to clipboard

Each of Wow's tables' rows written (PostgresCounters).

Link copied to clipboard
fun watch(): () -> Map<String, Double>

Watches the store's horizon over a window (PostgresCounters.watch), and the clone's snapshot table's layout.

Link copied to clipboard
fun watchWow(): () -> Map<String, Double>

As watch, with Wow's snapshot table's layout: Wow's own run's.

Link copied to clipboard
fun wowToday(connection: Connection, owned: Aggregates, logBatch: Int, snapshotBatch: Int): Flushed

Today's flush of logBatch commands: their append, then the worker's snapshots behind it snapshotBatch a transaction, async (savedBehind). A command counts once its snapshot was written.