Skip to content

Add a possibility to clear the SQL sequence cache #1378

@Portree-Kid

Description

@Portree-Kid

We have a very special edge case. The application in question incorporates a backup/restore functionality. For this all tables/sequences are exported and restored.

https://github.com/Portree-Kid/javers-rollback-problem

This project demonstrates a problem within Javers. There are a few tests using Javers and demonstrating the basic usage.

JaversRollbackProblemApplicationTestsBackupRestore.java uses an edge case we require. The database is backed up and restored. To perform the restore all sequences are reset to their previous value. For test purposes basically all tables are deleted and the sequences reset.

Playing with the value of

private static final long SEQUENCE_ALLOCATION_SIZE = 1;

will show the problem.

With

private static final long SEQUENCE_ALLOCATION_SIZE = 100;

the tests will fail since org.javers.repository.sql.session.Sequence.currentValue still has a value and we get a non linear sequence that fails.

Expected Behaviour

The sequences must adhere to the database state.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions