Skip to content

Latest commit

 

History

History
2099 lines (1340 loc) · 88.5 KB

File metadata and controls

2099 lines (1340 loc) · 88.5 KB

src/minisql/server/database_manager.ml

Home · Files

Provides minisql server database manager facilities for this project.

Package: minisql.server.database_manager

Reachable from entry: yes

Imports

Declarations

acquireIndexReadHandle

function acquireIndexReadHandle(database, path)

Acquires or lazily opens one persistent read-only index tree. The registry guard prevents duplicate publication; explicit-offset native reads require no per-query lock after the immutable tree has been published.

Parameter Type Default Description
database dynamic database value consumed by this operation.
path dynamic Path of the file or directory used by the operation.

View source

acquireStatementRead

function acquireStatementRead(database, transactionId, isolationLevel)

Acquires statement read using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
transactionId dynamic Identifier of transaction.
isolationLevel dynamic isolationLevel value consumed by this operation.

View source

acquireTableReadHandle

function acquireTableReadHandle(database, path)

Acquires or lazily opens one persistent read-only table PagedFile.

Parameter Type Default Description
database dynamic database value consumed by this operation.
path dynamic Path of the file or directory used by the operation.

View source

acquireWrite

function acquireWrite(database, transactionId)

Acquires write using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
transactionId dynamic Identifier of transaction.

View source

activeConcurrentReaders

function activeConcurrentReaders(database)

Returns the number of readers currently admitted through the physical execution gate. This diagnostic is safe while sessions are still active.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

activeWriter

function activeWriter(database)

Implements active writer for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

admitStatement

function admitStatement(database)

Rejects new statements before they can amplify an already exhausted heap. heap_bytes_committed is the runtime's reserved arena and may deliberately exceed the policy, so admission is based on live managed bytes instead.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

advancePlanningGeneration

function advancePlanningGeneration(database)

Advances the shared generation after committed DDL or statistics maintenance.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

allocateSessionId

function allocateSessionId(database)

Implements allocate session identifier for this module. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

audit

function audit(database, eventType, outcome, sessionId, principalId, detail)

Implements audit for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
eventType dynamic eventType value consumed by this operation.
outcome dynamic outcome value consumed by this operation.
sessionId dynamic Identifier of session.
principalId dynamic Identifier of principal.
detail dynamic detail value consumed by this operation.

View source

begin

function begin(database, isolationLevel, readOnly)

Implements begin for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
isolationLevel dynamic isolationLevel value consumed by this operation.
readOnly dynamic readOnly value consumed by this operation.

View source

beginOperationalStatement

function beginOperationalStatement(database, sessionId, principalId, sqlText)

Marks a session as executing and stores only a bounded SQL summary.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.
principalId dynamic Identifier of principal.
sqlText dynamic sqlText value consumed by this operation.

View source

bytesEqual

function bytesEqual(left, right)

Performs the bytesEqual operation for the minisql server database manager module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
left dynamic left value consumed by this operation.
right dynamic right value consumed by this operation.

View source

cancelLockWait

function cancelLockWait(database, transactionId)

Implements cancel lock wait for this module. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
database dynamic database value consumed by this operation.
transactionId dynamic Identifier of transaction.

View source

CHECKPOINT_MARKER_BYTES

const CHECKPOINT_MARKER_BYTES = 24

Durable marker formats used to make physical WAL reset crash-safe. The epoch

View source

checkpointAfterStatement

function checkpointAfterStatement(database)

Runs post-commit checkpoint maintenance without changing an already durable SQL outcome into a retryable client error. Failures remain visible in the server log and the next writer retries while the intact WAL stays recoverable.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

checkpointIfNeeded

function checkpointIfNeeded(database)

Resets the current WAL at a fully published statement boundary once it reaches the configured threshold. The caller must hold exclusive database execution, which guarantees that every WAL record being discarded already has a durable base-file page image and that no commit can race the reset. Persistent epoch replay avoids comparing new low LSNs with page LSNs from a previous physical WAL generation.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

checkpointMarkerBytes

function checkpointMarkerBytes(magic, databaseId)

Encodes an eight-byte marker magic and the database identity into one small, self-identifying durable record.

Parameter Type Default Description
magic dynamic magic value consumed by this operation.
databaseId dynamic Identifier of database.

View source

checkpointResetCount

function checkpointResetCount(database)

Returns the number of successful process-local automatic WAL resets.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

close

function close(database)

Closes close owned by the minisql server database manager module. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

CLOSED_HANDLE

const CLOSED_HANDLE = 9008

Defines the closed handle constant used by the minisql server database manager module.

View source

closeReadHandleCache

function closeReadHandleCache(database)

Permanently closes the database-owned registry during database shutdown.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

closeReadHandleMap

function closeReadHandleMap(values)

Closes every entry in one raw HashMap while the registry and writer gates are held. Iterating occupied slots avoids allocating a temporary values array.

Parameter Type Default Description
values dynamic values value consumed by this operation.

View source

closeRecoveryFiles

function closeRecoveryFiles(files)

Closes recovery files using the supplied inputs. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
files dynamic files value consumed by this operation.

View source

componentName

function componentName()

Performs the componentName operation for the minisql server database manager module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

configureOperationalLimits

function configureOperationalLimits(database, maxStatementBytes, maxFrameBytes, maxResultRows, idleTimeoutMs)

Applies validated protocol and result limits before the listener accepts clients.

Parameter Type Default Description
database dynamic database value consumed by this operation.
maxStatementBytes dynamic maxStatementBytes value consumed by this operation.
maxFrameBytes dynamic maxFrameBytes value consumed by this operation.
maxResultRows dynamic maxResultRows value consumed by this operation.
idleTimeoutMs dynamic idleTimeoutMs value consumed by this operation.

View source

configureProductionControls

function configureProductionControls(database, queryTimeoutMs, maxResultBytes, processMemoryBytes, temporaryStorageBytes, slowQueryMs)

Applies process-wide admission, response, spill, timeout, and slow-query policy.

Parameter Type Default Description
database dynamic database value consumed by this operation.
queryTimeoutMs dynamic queryTimeoutMs value consumed by this operation.
maxResultBytes dynamic maxResultBytes value consumed by this operation.
processMemoryBytes dynamic processMemoryBytes value consumed by this operation.
temporaryStorageBytes dynamic temporaryStorageBytes value consumed by this operation.
slowQueryMs dynamic slowQueryMs value consumed by this operation.

View source

configureWriteFencing

function configureWriteFencing(database, leasePath, epoch, nodeId, clockSkewMs)

Enables controller-backed write fencing for this process. Startup fails closed unless the persistent database term exactly matches the process term; this prevents an old command line from restarting a retired primary.

Parameter Type Default Description
database dynamic database value consumed by this operation.
leasePath dynamic Path associated with lease.
epoch dynamic epoch value consumed by this operation.
nodeId dynamic Identifier of node.
clockSkewMs dynamic clockSkewMs value consumed by this operation.

View source

CORRUPT_DATA

const CORRUPT_DATA = 9004

Defines the corrupt data constant used by the minisql server database manager module.

View source

create

function create(dataRoot, name, defaults)

Creates create for the minisql server database manager module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
dataRoot dynamic dataRoot value consumed by this operation.
name dynamic Name of the affected item.
defaults dynamic defaults value consumed by this operation.

View source

createExecutionGate

function createExecutionGate()

Creates a writer-prioritized gate in the empty state. Returns the gate or a threading error after closing any partially created primitive.

View source

createReadHandleCache

function createReadHandleCache()

Creates an empty persistent read-handle registry. Handles are opened lazily so databases with many cold tables consume no native handle resources.

View source

createTable

function createTable(database, name, definitions)

Creates table using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
name dynamic Name of the affected item.
definitions dynamic definitions value consumed by this operation.

View source

DEFAULT_BUFFER_POOL_BYTES

const DEFAULT_BUFFER_POOL_BYTES = 268435456

Defines the default buffer pool bytes constant used by the minisql server database manager module.

View source

DEFAULT_CHECKPOINT_WAL_BYTES

const DEFAULT_CHECKPOINT_WAL_BYTES = 67108864

Defines the default checkpoint wal bytes constant used by the minisql server database manager module.

View source

DEFAULT_IDLE_TIMEOUT_MS

const DEFAULT_IDLE_TIMEOUT_MS = 300000

Defines the default idle timeout ms constant used by the minisql server database manager module.

View source

DEFAULT_MAX_FRAME_BYTES

const DEFAULT_MAX_FRAME_BYTES = 8388608

Defines the default max frame bytes constant used by the minisql server database manager module.

View source

DEFAULT_MAX_RESULT_BYTES

const DEFAULT_MAX_RESULT_BYTES = 268435456

Defines the default max result bytes constant used by the minisql server database manager module.

View source

DEFAULT_MAX_RESULT_ROWS

const DEFAULT_MAX_RESULT_ROWS = 1000000

Defines the default max result rows constant used by the minisql server database manager module.

View source

DEFAULT_MAX_STATEMENT_BYTES

const DEFAULT_MAX_STATEMENT_BYTES = 1048576

Defines the default max statement bytes constant used by the minisql server database manager module.

View source

DEFAULT_PROCESS_MEMORY_BYTES

const DEFAULT_PROCESS_MEMORY_BYTES = 2147483648

Defines the default process memory bytes constant used by the minisql server database manager module.

View source

DEFAULT_QUERY_MEMORY_BYTES

const DEFAULT_QUERY_MEMORY_BYTES = 67108864

Defines the default query memory bytes constant used by the minisql server database manager module.

View source

DEFAULT_QUERY_TIMEOUT_MS

const DEFAULT_QUERY_TIMEOUT_MS = 30000

Defines the default query timeout ms constant used by the minisql server database manager module.

View source

DEFAULT_SLOW_QUERY_MS

const DEFAULT_SLOW_QUERY_MS = 1000

Defines the default slow query ms constant used by the minisql server database manager module.

View source

DEFAULT_TEMPORARY_STORAGE_BYTES

const DEFAULT_TEMPORARY_STORAGE_BYTES = 1073741824

Defines the default temporary storage bytes constant used by the minisql server database manager module.

View source

enforceProcessMemory

function enforceProcessMemory(database)

Enforces the managed-heap ceiling for already admitted work at cooperative executor/storage poll boundaries. The terminal statement accounts the single resource rejection, avoiding one counter increment per observed boundary.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

ensureCheckpointMarker

function ensureCheckpointMarker(path, expected)

Creates a marker durably or validates an already durable retry instance.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
expected dynamic expected value consumed by this operation.

View source

enterExecution

function enterExecution(database)

Backward-compatible names denote exclusive engine execution. Authentication, session lifecycle and every mutating SQL statement use this writer path. Acquires exclusive database execution in writer-priority order. Holding the turnstile while waiting for roomEmpty blocks newly arriving readers, so a sustained read workload cannot starve mutations.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

enterExecutionControlled

function enterExecutionControlled(database, sessionId)

Cancellation-aware exclusive admission. The writer retains turnstile while waiting for readers to leave, preserving writer priority between timed polls.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

enterReadExecution

function enterReadExecution(database)

Admits one shared reader through the writer-priority turnstile. The first reader acquires roomEmpty; later readers only increment the protected count. Returns true or an unavailable/closed-gate error.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

enterReadExecutionControlled

function enterReadExecutionControlled(database, sessionId)

Cancellation-aware shared-gate admission for SQL statements. Short timed waits keep administrative cancellation and the absolute statement deadline observable even while a writer currently owns the physical database gate.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

fail

function fail(code, operation, message)

Performs the fail operation for the minisql server database manager module. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
code dynamic code value consumed by this operation.
operation dynamic operation value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

findTable

function findTable(database, name)

Finds table using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
name dynamic Name of the affected item.

View source

finishOperationalStatement

function finishOperationalStatement(database, sessionId, success, rowCount)

Completes one operational statement and advances cumulative counters.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.
success dynamic success value consumed by this operation.
rowCount dynamic Number of row to process.

View source

finishStatement

function finishStatement(database, lease)

Implements finish statement for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
lease dynamic lease value consumed by this operation.

View source

idleTimeoutMs

function idleTimeoutMs(database)

Returns the configured idle-connection timeout.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

indexesReady

function indexesReady(database)

Returns whether the one-time process-local index readiness pass completed. The execution-gate state lock makes this probe safe during concurrent accepts.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

Defines the invalid argument constant used by the minisql server database manager module.

View source

invalidateReadCache

function invalidateReadCache(database)

Invalidates committed page images after a successful mutation. The caller holds exclusive execution, so no reader can observe a stale/new mixture.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

invalidateReadHandles

function invalidateReadHandles(database)

Invalidates persistent file and metadata handles after any successful writer. The caller owns the database writer gate, so no active lease can race close.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

isImplemented

function isImplemented()

Returns whether implemented satisfies the condition required by the minisql server database manager module. Returns the computed value or operation status. Does not modify its inputs.

View source

isLockWaiting

function isLockWaiting(database, transactionId)

Returns whether a transaction is still blocked in the logical lock graph. Listener workers use this probe to wait without reparsing or re-executing SQL.

Parameter Type Default Description
database dynamic database value consumed by this operation.
transactionId dynamic Identifier of transaction.

View source

isManagedDatabase

function isManagedDatabase(value)

Returns whether the supplied value satisfies the managed database condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isSessionCancellationRequested

function isSessionCancellationRequested(database, sessionId)

Returns the synchronized cancellation flag polled by executor operators.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

isShutdownRequested

function isShutdownRequested(database)

Returns whether an administrator requested cooperative listener shutdown.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

isStandby

function isStandby(database)

Returns whether the supplied value satisfies the standby condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

LEADER_EPOCH_BYTES

const LEADER_EPOCH_BYTES = 32

Defines the leader epoch bytes constant used by the minisql server database manager module.

View source

LEADER_LEASE_BYTES

const LEADER_LEASE_BYTES = 64

Defines the leader lease bytes constant used by the minisql server database manager module.

View source

leaderEpochPath

function leaderEpochPath(path)

Returns the durable per-database leadership-term record path. The HA controller replaces this record while the database is offline before it starts a process for a newer epoch.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

leaveExecution

function leaveExecution(database)

Releases exclusive database execution, opening the room before the turnstile. Returns an error if either synchronization primitive cannot be released.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

leaveReadExecution

function leaveReadExecution(database)

Removes one shared reader and releases roomEmpty when the last reader exits. Returns an error for an invalid database, unavailable lock, or unbalanced leave.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

markIndexesReady

function markIndexesReady(database)

Publishes completion of process-local index readiness to later sessions.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

maxFrameBytes

function maxFrameBytes(database)

Returns the configured hard response-frame limit.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

maxResultBytes

function maxResultBytes(database)

Returns the aggregate encoded result byte ceiling.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

maxResultRows

function maxResultRows(database)

Returns the configured hard result-row limit.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

maxStatementBytes

function maxStatementBytes(database)

Returns the configured hard statement-size limit.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

open

function open(path)

Opens open for the minisql server database manager module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

openInternal

function openInternal(path, allowStandby, checkpointWalBytes, bufferPoolBytes, queryMemoryBytes)

Opens internal using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
allowStandby dynamic allowStandby value consumed by this operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.
bufferPoolBytes dynamic bufferPoolBytes value consumed by this operation.
queryMemoryBytes dynamic queryMemoryBytes value consumed by this operation.

View source

openStandby

function openStandby(path)

Opens standby using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

openStandbyWithBudgets

function openStandbyWithBudgets(path, checkpointWalBytes, bufferPoolBytes, queryMemoryBytes)

Opens a standby database with explicit WAL, cache, and per-query budgets.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.
bufferPoolBytes dynamic bufferPoolBytes value consumed by this operation.
queryMemoryBytes dynamic queryMemoryBytes value consumed by this operation.

View source

openStandbyWithCheckpoint

function openStandbyWithCheckpoint(path, checkpointWalBytes)

Opens a standby with the configured checkpoint threshold. Standbys never initiate a reset, but retaining the value keeps promotion configuration exact.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.

View source

openStandbyWithRuntime

function openStandbyWithRuntime(path, checkpointWalBytes, bufferPoolBytes)

Opens a standby with configured WAL and buffer-pool budgets.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.
bufferPoolBytes dynamic bufferPoolBytes value consumed by this operation.

View source

openWithBudgets

function openWithBudgets(path, checkpointWalBytes, bufferPoolBytes, queryMemoryBytes)

Opens a writable database with explicit WAL, cache, and per-query budgets.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.
bufferPoolBytes dynamic bufferPoolBytes value consumed by this operation.
queryMemoryBytes dynamic queryMemoryBytes value consumed by this operation.

View source

openWithCheckpoint

function openWithCheckpoint(path, checkpointWalBytes)

Opens a primary database with a configured maximum current-WAL size.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.

View source

openWithRuntime

function openWithRuntime(path, checkpointWalBytes, bufferPoolBytes)

Opens a primary database with configured WAL and buffer-pool budgets.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
checkpointWalBytes dynamic checkpointWalBytes value consumed by this operation.
bufferPoolBytes dynamic bufferPoolBytes value consumed by this operation.

View source

operationalSessions

function operationalSessions(database)

Returns immutable copies of all active process-list entries.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

operationalStatus

function operationalStatus(database)

Returns a compact numeric snapshot used by SHOW STATUS.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

peakConcurrentReaders

function peakConcurrentReaders(database)

Implements peak concurrent readers for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

planningGeneration

function planningGeneration(database)

Returns the process-local optimizer invalidation generation shared by every session attached to this managed database.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

pollSessionControl

function pollSessionControl(database, sessionId)

Polls the registry without depending on executor-owned state. Storage batch loops use this to stop long scans at page/row boundaries.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

publishReadHandleLease

function publishReadHandleLease(cache, entry)

Records one lease while the registry guard is held and returns its token.

Parameter Type Default Description
cache dynamic cache value consumed by this operation.
entry dynamic entry value consumed by this operation.

View source

QUERY_CANCELLED

const QUERY_CANCELLED = 9035

Defines the query cancelled constant used by the minisql server database manager module.

View source

QUERY_TIMEOUT

const QUERY_TIMEOUT = 9036

Defines the query timeout constant used by the minisql server database manager module.

View source

queryMemoryLimit

function queryMemoryLimit(database)

Returns the soft blocking-operator budget inherited by a new session.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

queryTimeoutMs

function queryTimeoutMs(database)

Returns the cooperative execution deadline interval.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

readCacheStats

function readCacheStats(database)

Returns synchronized buffer-cache diagnostics.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

readerCount

function readerCount(database)

Implements reader count for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

readFenceBytes

function readFenceBytes(path, expectedSize, operation)

Reads one exact fencing record without accepting a prefix, trailing bytes, or a partially replaced file.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
expectedSize dynamic expectedSize value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

readHandleContext

function readHandleContext(lease)

Returns one context reused by every page read in this handle lease. Table scans that remain entirely in the buffer pool never allocate the context.

Parameter Type Default Description
lease dynamic lease value consumed by this operation.

View source

readHandleStats

function readHandleStats(database)

Returns synchronized persistent-handle cache counters.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

readHandleValue

function readHandleValue(lease)

Validates a caller lease and returns its storage value.

Parameter Type Default Description
lease dynamic lease value consumed by this operation.

View source

readLeaderEpoch

function readLeaderEpoch(path)

Decodes the persistent database term and node identity.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

readLeaderLease

function readLeaderLease(path)

Decodes the shared leader lease used as the online write-authority token.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

recordStatementDiagnostics

function recordStatementDiagnostics(database, elapsedMs, resultBytes, errorCode)

Records latency, encoded output, and terminal production-control outcomes.

Parameter Type Default Description
database dynamic database value consumed by this operation.
elapsedMs dynamic elapsedMs value consumed by this operation.
resultBytes dynamic resultBytes value consumed by this operation.
errorCode dynamic errorCode value consumed by this operation.

View source

refreshSchemaSnapshot

function refreshSchemaSnapshot(database)

Reloads and atomically publishes durable schema metadata after successful DDL. The relatively expensive file validation therefore occurs once per schema change instead of once per query or affected row.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

registerSessionPeer

function registerSessionPeer(database, sessionId, peerEndpoint, secure, authenticated)

Updates connection metadata after the listener resolves the remote endpoint.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.
peerEndpoint dynamic peerEndpoint value consumed by this operation.
secure dynamic secure value consumed by this operation.
authenticated dynamic authenticated value consumed by this operation.

View source

releaseLocks

function releaseLocks(database, transactionId)

Releases locks using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
transactionId dynamic Identifier of transaction.

View source

releaseReadHandle

function releaseReadHandle(lease)

Releases one table or index lease after the complete storage operation. The owning execution-gate read lease prevents concurrent invalidation.

Parameter Type Default Description
lease dynamic lease value consumed by this operation.

View source

releaseTemporaryStorage

function releaseTemporaryStorage(database, byteCount)

Releases a prior spill reservation; cleanup is idempotent at zero.

Parameter Type Default Description
database dynamic database value consumed by this operation.
byteCount dynamic Number of byte to process.

View source

requestSessionCancellation

function requestSessionCancellation(database, sessionId)

Requests cancellation of one currently executing session.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

requestShutdown

function requestShutdown(database)

Requests a cooperative listener stop after the current statement response.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

reserveTemporaryStorage

function reserveTemporaryStorage(database, byteCount)

Reserves spill capacity atomically across all concurrent statements.

Parameter Type Default Description
database dynamic database value consumed by this operation.
byteCount dynamic Number of byte to process.

View source

resetPeakConcurrentReaders

function resetPeakConcurrentReaders(database)

Resets peak concurrent readers using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

RESOURCE_LIMIT

const RESOURCE_LIMIT = 9037

Defines the resource limit constant used by the minisql server database manager module.

View source

rotateAudit

function rotateAudit(database, sessionId, principalId)

Implements rotate audit for this module. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.
principalId dynamic Identifier of principal.

View source

schemaSnapshot

function schemaSnapshot(database)

Returns the immutable schema snapshot published for this database. Schema states are never modified after publication, so readers may safely retain the returned value for the duration of their physical execution-gate lease.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

setOperationalPrincipal

function setOperationalPrincipal(database, sessionId, principalId)

Publishes the principal selected by a successful authentication exchange.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.
principalId dynamic Identifier of principal.

View source

setQueryMemoryLimit

function setQueryMemoryLimit(database, queryMemoryBytes)

Configures the per-session query budget before a listener accepts clients.

Parameter Type Default Description
database dynamic database value consumed by this operation.
queryMemoryBytes dynamic queryMemoryBytes value consumed by this operation.

View source

STANDBY_NOT_PROMOTED

const STANDBY_NOT_PROMOTED = 9033

Defines the standby not promoted constant used by the minisql server database manager module.

View source

targetMilestone

function targetMilestone()

Performs the targetMilestone operation for the minisql server database manager module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

unregisterSession

function unregisterSession(database, sessionId)

Removes a closed session from the process list without changing cumulative totals.

Parameter Type Default Description
database dynamic database value consumed by this operation.
sessionId dynamic Identifier of session.

View source

validateCheckpointMarker

function validateCheckpointMarker(path, expected)

Reads and validates a checkpoint marker before its state can affect recovery.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
expected dynamic expected value consumed by this operation.

View source

validateFenceHeader

function validateFenceHeader(payload, magic, expectedSize, operation)

Validates a fixed-size CRC-32C protected record header shared with the Python HA controller. The checksum field is always the final four bytes.

Parameter Type Default Description
payload dynamic payload value consumed by this operation.
magic dynamic magic value consumed by this operation.
expectedSize dynamic expectedSize value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

validateOpen

function validateOpen(database, operation)

Validates open for the minisql server database manager workflow. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

validateWriteFence

function validateWriteFence(database)

Validates persistent and live leadership immediately before a mutation or durable commit. Missing, malformed, expired, foreign, and rolled-back terms all reject writes while reads and rollback remain available.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

verifyAudit

function verifyAudit(database)

Verifies audit using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

waiterCount

function waiterCount(database)

Implements waiter count for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.

View source

walEpochPath

function walEpochPath(path)

Returns the persistent marker path that selects bounded-WAL epoch recovery.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

walResetPendingPath

function walResetPendingPath(path)

Returns the transient crash-recovery journal for an in-progress WAL reset.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

WRITE_FENCED

const WRITE_FENCED = 9038

Defines the write fenced constant used by the minisql server database manager module.

View source