KandraMigrationRunner

constructor(session: CqlSession, staleClaimThreshold: Duration = Duration.ofMinutes(10))

Parameters

staleClaimThreshold

how long a MigrationRowStatus.CLAIMED row is given the benefit of the doubt (treated as possibly still in progress elsewhere) before run() refuses to proceed and throws instead. Compared against an age measured entirely by the database cluster's own clock (see "Clock source for staleness" above). Defaults to 10 minutes.

DDL bootstrap coordination (GH #79/ISS-071)

The CREATE TABLE IF NOT EXISTS kandra_migrations + legacy-column ALTER TABLEs below used to run unconditionally, every time a KandraMigrationRunner was constructed -- if several application instances construct one concurrently against a keyspace that doesn't have the table yet (the normal shape of a rolling multi-replica deploy), they raced the same DDL against the cluster. This is now guarded by claimAndRunDdlBootstrap the same way kandra-ktor's SchemaMode.AUTO_CREATE/AUTO_MIGRATE DDL is guarded: one instance wins an INSERT ... IF NOT EXISTS LWT claim and runs the bootstrap, the rest poll until it reports done. If the claim holder goes silent for longer than two minutes (measured by the cluster's own clock, not any application instance's), a waiting instance presumes it crashed mid-bootstrap and reclaims it. See claimAndRunDdlBootstrap's own KDoc, further down this file, for the full mechanism -- it's the same design as this class's own per-migration claim above, just applied one level earlier, to the bookkeeping table's own creation.