Execution Flow#
Startup Lifecycle#
The service lifecycle is deterministic and runs before the BaSyx services start:
Parse command-line flags.
Create an empty
ExecutionContext.Create a
SchemaInitializer.Register sequences in the intended execution order.
Execute all sequences sequentially.
Close the database handle.
Exit with status
0on success or status1on failure.
Current Registered Order#
The service currently registers:
DatabaseConnectionSystemTableSchemaUploadSchemaPatchfor101.sqltargetingv1.0.1
These components are described in the architecture overview.
Flow Diagram#
Hint
The diagram shows the current example with one registered patch path to v1.0.1. If multiple patches are registered, the SchemaPatch step repeats in registration order.
Error Handling#
SchemaInitializer.Execute() stops on the first sequence error. Errors are wrapped with BASYXCFG-INIT-EXECSTEP, including the failed sequence index and status code.
Sequences return:
0, nilon success.Non-zero status and an error on failure.
The main function logs the wrapped error as BASYXCFG-MAIN-EXECUTE and exits with status 1.
Locking Behavior#
SystemTable, SchemaUpload, and SchemaPatch use the same PostgreSQL advisory lock ID. This serializes schema changes across concurrent Configuration Service instances.
The patch sequence acquires the advisory lock before reading the current database version. This prevents two instances from both deciding that a patch must run based on the same old version.