Provides minisql server database manager facilities for this project.
Package: minisql.server.database_manager
Reachable from entry: yes
minisql/catalog/catalog.mlascatalog→ src/minisql/catalog/catalog.mlminisql/catalog/schema_history.mlasschema_history→ src/minisql/catalog/schema_history.mlminisql/common/crc32c.mlascrc32c→ src/minisql/common/crc32c.mlminisql/common/diagnostics.mlasdiagnostics→ src/minisql/common/diagnostics.mlminisql/common/endian.mlasendian→ src/minisql/common/endian.mlminisql/common/logger.mlaslogger→ src/minisql/common/logger.mlminisql/platform/clock.mlasclock→ src/minisql/platform/clock.mlminisql/platform/file.mlasfile_api→ src/minisql/platform/file.mlminisql/platform/lock.mlasfile_lock→ src/minisql/platform/lock.mlminisql/storage/btree.mlasbtree→ src/minisql/storage/btree.mlminisql/storage/buffer_pool.mlasbuffer_pool→ src/minisql/storage/buffer_pool.mlminisql/storage/paged_file.mlaspaged_file→ src/minisql/storage/paged_file.mlminisql/transaction/checkpoint.mlascheckpoint→ src/minisql/transaction/checkpoint.mlminisql/transaction/lock_manager.mlaslock_manager→ src/minisql/transaction/lock_manager.mlminisql/transaction/recovery.mlasrecovery→ src/minisql/transaction/recovery.mlminisql/transaction/transaction.mlastransaction→ src/minisql/transaction/transaction.mlminisql/transaction/wal.mlaswal→ src/minisql/transaction/wal.mlstd/ds/hashmap.mlashashmap→../MiniLangCompilerML/std/ds/hashmap.ml— external dependencystd/ds/list.mlaslist→../MiniLangCompilerML/std/ds/list.ml— external dependencystd/threading.mlasthreading→../MiniLangCompilerML/std/threading.ml— external dependencystd/time.mlastime_api→../MiniLangCompilerML/std/time.ml— external dependency
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
const CHECKPOINT_MARKER_BYTES = 24Durable marker formats used to make physical WAL reset crash-safe. The epoch
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. |
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. |
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. |
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. |
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. |
const CLOSED_HANDLE = 9008Defines the closed handle constant used by the minisql server database manager module.
function closeReadHandleCache(database)Permanently closes the database-owned registry during database shutdown.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
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. |
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.
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. |
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. |
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. |
const CORRUPT_DATA = 9004Defines the corrupt data constant used by the minisql server database manager module.
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. |
function createExecutionGate()Creates a writer-prioritized gate in the empty state. Returns the gate or a threading error after closing any partially created primitive.
function createReadHandleCache()Creates an empty persistent read-handle registry. Handles are opened lazily so databases with many cold tables consume no native handle resources.
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. |
const DEFAULT_BUFFER_POOL_BYTES = 268435456Defines the default buffer pool bytes constant used by the minisql server database manager module.
const DEFAULT_CHECKPOINT_WAL_BYTES = 67108864Defines the default checkpoint wal bytes constant used by the minisql server database manager module.
const DEFAULT_IDLE_TIMEOUT_MS = 300000Defines the default idle timeout ms constant used by the minisql server database manager module.
const DEFAULT_MAX_FRAME_BYTES = 8388608Defines the default max frame bytes constant used by the minisql server database manager module.
const DEFAULT_MAX_RESULT_BYTES = 268435456Defines the default max result bytes constant used by the minisql server database manager module.
const DEFAULT_MAX_RESULT_ROWS = 1000000Defines the default max result rows constant used by the minisql server database manager module.
const DEFAULT_MAX_STATEMENT_BYTES = 1048576Defines the default max statement bytes constant used by the minisql server database manager module.
const DEFAULT_PROCESS_MEMORY_BYTES = 2147483648Defines the default process memory bytes constant used by the minisql server database manager module.
const DEFAULT_QUERY_MEMORY_BYTES = 67108864Defines the default query memory bytes constant used by the minisql server database manager module.
const DEFAULT_QUERY_TIMEOUT_MS = 30000Defines the default query timeout ms constant used by the minisql server database manager module.
const DEFAULT_SLOW_QUERY_MS = 1000Defines the default slow query ms constant used by the minisql server database manager module.
const DEFAULT_TEMPORARY_STORAGE_BYTES = 1073741824Defines the default temporary storage bytes constant used by the minisql server database manager module.
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
function idleTimeoutMs(database)Returns the configured idle-connection timeout.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
const INVALID_ARGUMENT = 9001Defines the invalid argument constant used by the minisql server database manager module.
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. |
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. |
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.
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. |
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. |
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. |
function isShutdownRequested(database)Returns whether an administrator requested cooperative listener shutdown.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
const LEADER_EPOCH_BYTES = 32Defines the leader epoch bytes constant used by the minisql server database manager module.
const LEADER_LEASE_BYTES = 64Defines the leader lease bytes constant used by the minisql server database manager module.
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. |
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. |
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. |
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. |
function maxFrameBytes(database)Returns the configured hard response-frame limit.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function maxResultBytes(database)Returns the aggregate encoded result byte ceiling.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function maxResultRows(database)Returns the configured hard result-row limit.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function maxStatementBytes(database)Returns the configured hard statement-size limit.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
function operationalSessions(database)Returns immutable copies of all active process-list entries.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function operationalStatus(database)Returns a compact numeric snapshot used by SHOW STATUS.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
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. |
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. |
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. |
const QUERY_CANCELLED = 9035Defines the query cancelled constant used by the minisql server database manager module.
const QUERY_TIMEOUT = 9036Defines the query timeout constant used by the minisql server database manager module.
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. |
function queryTimeoutMs(database)Returns the cooperative execution deadline interval.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function readCacheStats(database)Returns synchronized buffer-cache diagnostics.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
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. |
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. |
- minisql.server.database_manager.ReadHandleCache — struct
- minisql.server.database_manager.ReadHandleCacheStats — struct
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. |
function readHandleStats(database)Returns synchronized persistent-handle cache counters.
| Parameter | Type | Default | Description |
|---|---|---|---|
database |
dynamic |
— | database value consumed by this operation. |
function readHandleValue(lease)Validates a caller lease and returns its storage value.
| Parameter | Type | Default | Description |
|---|---|---|---|
lease |
dynamic |
— | lease value consumed by this operation. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
const RESOURCE_LIMIT = 9037Defines the resource limit constant used by the minisql server database manager module.
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. |
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. |
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. |
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. |
const STANDBY_NOT_PROMOTED = 9033Defines the standby not promoted constant used by the minisql server database manager module.
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.
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
const WRITE_FENCED = 9038Defines the write fenced constant used by the minisql server database manager module.