Upgrading
Two things must stay compatible for an upgrade to be safe: your code, which must keep compiling, and the storage format, which nodes of different versions share while you roll the upgrade. Simba's version numbers state both.
What a Version Promises
Simba follows Semantic Versioning at the source level: within a major version, code that compiled against an earlier release compiles against a later one unchanged, so recompile when you upgrade. Binary compatibility (running code compiled against another release without recompiling) is not promised. Source-breaking changes of the following only happen in a major version:
| Area | Covered |
|---|---|
| Core API | Public types of me.ahoo.simba, me.ahoo.simba.partition, me.ahoo.simba.event, me.ahoo.simba.spi |
| Backends | Public classes of simba-jdbc, simba-redis, simba-spring-redis, simba-zookeeper (JdbcLeaseBackend, Dialect, RedisLeaseBackend, RedisScripting, SpringRedisScripting, ZookeeperLeaseBackend, ...) |
| Spring Boot starter | Public types and annotations (@SimbaScheduled, @SimbaPartitioned, the *Properties classes, SimbaLifecycle, MicrometerSimbaEventListener, SimbaEndpoint, SimbaHealthIndicator), the simba.* properties, bean names and conditions |
| Coroutines | simba-coroutines (since 5.1): the functions and types of me.ahoo.simba.coroutines (awaitAcquire, awaitTryAcquire, withLock, awaitRevoked, SimbaEventFlow) |
| Test kits | simba-testing (InMemoryLeaseBackend, VirtualClock, VirtualScheduler, Simulation) and simba-tck (LeaseBackendSpec, FencingSpec) |
| Observability | Metric names and tag keys, the Actuator endpoint's and the health indicator's JSON fields |
| Storage | The JDBC schema, the Redis keys and messages, the Zookeeper paths |
New fields, tags, enum constants and events may be added in a minor version: read JSON and handle when over Simba enums and events tolerantly. Types marked @InternalSimbaApi (the engine, Simba.Builder.scheduler, Simba.awaitIdle) and anything internal carry no guarantee.
Within 5.x
Minor and patch releases keep the storage format, so nodes of different 5.x versions contend for the same names and see each other's leases: roll the upgrade node by node. Release notes list every change: GitHub Releases.
5.0 to 5.1
5.1 adds API, changes how the Redis backend times its calls on a Cluster and how the Zookeeper backend confirms keep-alives, and keeps 5.0's storage, so nodes of both versions can run side by side:
- Zookeeper keep-alives are confirmed through the leader, and a keep-alive leaves
5/12of the session timeout instead of all of it (a follower cut off from the leader could renew a session the leader was about to expire). With the default 15 s lease a node keeps its terms through a pause of about 6 s instead of about 15 s, and renews about every two seconds. To tolerate longer pauses, raisesimba.session.lease-duration; failover after a crash grows with it. See Backends. simba.zookeeper.connection-timeoutandZookeeperLeaseBackend'sconnectionTimeoutdefault to the renew interval (5 s) instead of 15 s.DistributedLock.acquireAsync(timeout)andtryAcquireAsync()acquire a lock without blocking; see Locks. They are default methods, so your ownDistributedLockimplementations keep compiling unchanged.- The new optional module
simba-coroutinesadds suspending lock calls,withLock,Term.awaitRevoked()andSimbaEventFlow; it depends onkotlinx-coroutines-core, whichsimba-coredoes not. simba-testing:InMemoryLeaseBackend.builder()also setssessionBoundGrants, a grant lasting only what the session has left, as on Redis; new methods drive backend-side behavior from a test:beginSlotAcquire(returning aSlotAcquirewhosegranttakes the leases later, as a Cluster's lease-slot scripts do),peekOwnerandpeekExpiry(read without side effects),expireSessionandloseLease(a server ending a session early, a store losing a lease and its token).SimulationParamsaddssessionBoundGrants,truncatedGrantShare,meanInjectionInterval,groupPartitions,earlyCloseShareandbackendHints(see Testing). The existing constructors and parameters are unchanged.- The simulation is stricter: node clocks now change their rate over time (within
clockRateSpread), and I1 also checks that a valid term is the backend's owner, never outlasts the backend's grant, and never becomes valid again once invalid. Your own simulation tests, and seeds that passed on 5.0, may therefore fail on 5.1 and expose a problem that was there before; replay a failing seed to investigate. - Redis with
routeBySlot(a Cluster), where one call runs a script on the session's slot and then one per lease or group slot (Cluster):- Acquire and join fail with
SimbaExceptionand send nothing to the other slots once the session's remaining time has passed since the session call was sent. An acquire whose reply arrives later than that releases the terms it began, also on slots that granted, and fails; the engine retries as after any failed call. - A lease slot still grants, and extends a lease the holder acquires again, for one full session lease on its own clock, as in 5.0.
- Keep-alive now extends leases and memberships only by what the session has left (its new remaining time minus the time since the session call answered), not by a full lease from whenever the script ran: a delayed keep-alive no longer keeps a lease of a dead session for up to two leases.
- No node's
TIMEis compared with another's.
- Acquire and join fail with
From 4.x
5.0 changed the storage format, so a 4.x node and a 5.0 node do not see each other's leases and would both lead. The switch therefore needs every node stopped first; follow Migrating from 4.x to 5.0.