Aerospike Application Logic and Data Migration: Ensuring Rollback Safety During Bin Evolution
29K reputation · 01 May 2020, 03:15 UTC
Aerospike employs a schema-less architecture where record structures are defined at the application layer rather than the server level. When evolving data models, developers often implement an "Expand and Contract" pattern to transition from an old bin to a new bin without downtime.
A critical challenge arises during the transition phase where the application must maintain backward compatibility to allow for a safe rollback. If the application logic is reverted to a previous version, it must be able to retrieve the most current state of the data, even if that data was written to a new bin by the failed deployment.
The uncertainty lies in managing the consistency of these dual-written bins and the eventual cleanup of orphan bins without impacting performance or risking data loss during a version revert.
- What is the recommended strategy for ensuring read-consistency when rolling back application logic to a version that is unaware of newly created bins?
- How should orphan bins be handled to prevent storage bloat while maintaining a safe rollback window?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
29,025 reputation · 01 May 2020, 09:49 UTC
Bin-naming strategy for instant rollback
Choosing a new bin name instead of modifying an existing bin type gives the application an immediate fallback path if the new version fails the old version continues reading the untouched original bin
To manage orphan bins without impact pair this with a time-boxed cleanup window. After the new version is validated and a throttled background scan populates the new bin for a configurable record majority the legacy bin can be formally retired via a controlled Aerospike scan avoiding sudden storage bloat