checkSelfStatus() starts the promises branch at the slot position instead of the promised sequence, so recovery ranges are wrong

Open Beginner friendly
#11,013 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Read core/src/main/java/com/orientechnologies/orient/core/transaction/OTransactionSequenceManager.java around checkSelfStatus() and the existing sequenceMissingPromised test in core/src/test/java/.../OTransactionSequenceManagerTest.java. Compare the promise branch’s loop start with the no-promise path, then add exact expected-range cases where the slot position differs from the promised sequence. Run the focused sequence manager tests; done means all four reported ranges match the expected sets.

Written by the indexing model from the issue text.

Description

OrientDB Version: 3.2.55 (build 5a42e4f47183a1db1fa00186bd817dda57e24eeb)
Java Version: OpenJDK 1.8.0_492 (jdk8u492-b09)
OS: Linux x86_64 (official orientdb:latest image, Docker)

Expected behavior

OTransactionSequenceManager.checkSelfStatus() should return exactly the transaction ids that are missing locally relative to the remote sequence status. When a slot has an outstanding promise, the scan should start after the promised sequence (promise.getSequence() + 1), not at the slot index.

For the four bounded states below, the expected missing sets are:

Local slot state Remote status Expected missing Actual
slot 5 applied 1–3, promise 5:4 5:6 [5:4, 5:5, 5:6] [5:6]
slot 2 promise 2:1 2:5 [2:2, 2:3, 2:4, 2:5] [2:3, 2:4, 2:5]
slot 2 applied 1–10, promise 2:11 2:13 [2:12, 2:13] [2:3 … 2:13] (11 entries)
slot 2 applied 1–3, promise 2:4 2:6 [2:5, 2:6] [2:3, 2:4, 2:5, 2:6]

The no-promise control path returns the correct range in each case.

Actual behavior

The promise branch starts the loop at this.promisedSequential[i].getId().getPosition() + 1. getPosition() is the slot index, not the transaction sequence. This produces both under-reporting (slot 5 / promise 5:4 → starts at 6, dropping 5:4 and 5:5) and over-reporting (slot 2 / promise 2:11 → starts at 3, asking for already-applied 2:3 … 2:10). The result is passed to OrientDBDistributed.receivePing() → requestTransactions(), so catch-up either skips missing transactions or requests bogus historical ones.

Steps to reproduce

This is a bounded Java-level reproduction of the current source logic; no multi-node cluster is needed to observe the range calculation.

  1. Start the container (for the current-source class compilation and readiness/liveness evidence):
docker run -d --name orient-seq -p 127.0.0.1:32480:2480 \
  -e ORIENTDB_ROOT_PASSWORD=auditpass orientdb:latest
  1. Compile a small harness against the current OTransactionSequenceManager (the audit PoCs copy the current source classes into the container and compile them with javac):
OTransactionSequenceManager manager = new OTransactionSequenceManager(8, ...);
manager.nextAt(5);                         // promise 5:4 (or 2:11 in the second case)
OTransactionSequenceStatus remote = new OTransactionSequenceStatus(new long[]{0,0,0,0,0,6,0,0});
System.out.println(manager.checkSelfStatus(remote)); // actual [5:6]
  1. Compare the actual list with the expected sets in the table; repeat for the other three states.

Observed outputs: [5:6], [2:3,2:4,2:5], [2:3 … 2:13], [2:3,2:4,2:5,2:6]; the corresponding no-promise controls match the expected sets.

Additional context

  • core/src/main/java/com/orientechnologies/orient/core/transaction/OTransactionSequenceManager.java:159-160 — in the promise branch:
for (long x = this.promisedSequential[i].getId().getPosition() + 1; x <= status[i]; x++) {
  missing.add(new OTransactionId(i, x));
}
  • The correct lower bound is this.promisedSequential[i].getId().getSequence() + 1; getPosition() is the slot index, which only equals the sequence by coincidence in the simplest test data.
  • distributed/src/main/java/com/orientechnologies/orient/distributed/db/OrientDBDistributed.java:1658-1661 — receivePing() passes this list to requestTransactions().
  • core/src/test/java/.../OTransactionSequenceManagerTest.java:67-71 — the existing sequenceMissingPromised test only checks that the list contains missing items/size; it does not pin the exact range when position and promised sequence differ.

I re-checked current develop on 2026-11-17: the promise branch still uses getPosition() + 1 (line 173 in the current file).

Suggested fix: use getSequence() + 1 as the lower bound in the promise branch, and add exact-oracle tests for (a) position < sequence, (b) position > sequence, (c) already-applied sequences above the position. The four cases above can serve as regression cases.

Scope note: this is a method-level reproduction compiled from the current source, not a multi-node end-to-end recovery; the container provides the Java environment and version/liveness evidence. The stock 3.2.55 runtime jar does not contain the current-source package name, so the PoC compiles the current source class rather than calling the packaged one.

Dominant language
Java
Stars
5k
Forks
871
Avg merge
17h 38m
Merged PRs (30d)
40

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from orientechnologies/orientdb

All issues in orientechnologies/orientdb

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.