Delayed versioning
In order to improve performance when using versioning features, ODABA considers version intervals. Within a version interval, instance states may change without creating new instance versions. A version interval will be terminated by creating a new database or instance owner scope version.
In order to avoid unnecessary instance duplication, all versioning modes provided by ODABA use delayed versioning, i.e. when creating a new version (copy on write), affected database entries (instance, index) remain unchanged until their state changes. When changing the database entry state, a copy of the database entry is created containing the updated state for the requested version number..
Since versioning does not only apply on instances, but also on references and collections (indexes), new versions will be created for all database entries in a defined scope when the current version had been changed. Whether a database entry is duplicated before being updated simply depends on the fact, whether the current database entry version is lower than the current scope version or not. The current owner scope version for a database entry is determined depending on the versioning mode:
- Managed : the current scope version is defined on database level (major version number).
- Individual , Synchronized : The current scope version is the current version number of the global instance, which is the scope owner.
- Consistent : The current scope version is the last owner scope version created in the database.
As long as no changes apply to a database entry, the database entry version remains unchanged, i.e. a database entry version interval starts with the update version number and ends with the current scope version number when upgrading to the next higher version. This is not necessarily identical with the real time of change and it may also happen, that several changes of database entries happen within the same version interval and are not recorded as new versions. Thus, the granularity for versioning is determined by the application and depends on practical requirements. A database may contain only one version interval (all time points) but also create new versions for each update on any database entry.