Allocation rebalance is gated on isSynching() instead of being suppressed during sync

Open Beginner friendly
#11,017 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
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
distributed-systems, docker, java

Research direction

Start with the autoAssignAllocation() condition in distributed/src/main/java/com/orientechnologies/orient/distributed/db/OrientDBDistributed.java near line 339, and isSynching() in ODatabaseTopologyState.java around lines 531-532. Confirm the guard requires isSynching to be true, then negate it so rebalance runs only when no sync session is active. Done when a unit test fixes isQuorumOnline and isOnline and asserts autoAssignAllocations(true) for both isSynching values.

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

OrientDBDistributed.autoAssignAllocation() should rebalance allocations when the cluster is online and stable (no active sync session), and suppress rebalance while a sync session is active.

Concretely, with isQuorumOnline = true and the local node online:

  • isSynching() == false → rebalance should run (autoAssignAllocations(true)).
  • isSynching() == true → rebalance should be skipped.

Actual behavior

The condition is inverted: it requires databaseTopology.isSynching(dbId) to be true to run the rebalance:

if (isQuorumOnline && isOnline && databaseTopology.isSynching(dbId)) {
  autoAssignAllocations(true);
}

isSynching() returns !this.syncSessions.isEmpty(), i.e. it is true when a sync session is active. So a stable cluster never rebalances, while a sync window does — the opposite of the intended "avoid rebalance during sync" behavior.

Steps to reproduce

This is a source-level truth-table oracle of the current condition (the container is used for a clean start, version/liveness and a control query).

  1. Read OrientDBDistributed.autoAssignAllocation() and ODatabaseTopologyState.isSynching() from the current source.
  2. Evaluate the branch under two bounded states:
steady_state_no_sync:  isQuorumOnline=true, isOnline=true, isSynching=false
  expected autoAssign=true,  actual autoAssign=false

active_sync_session:   isQuorumOnline=true, isOnline=true, isSynching=true
  expected autoAssign=false, actual autoAssign=true
  1. Control: SELECT 1 AS value returns {"result":[{"value":1}]}, and the container stays alive.

Observed: source_probe.json reports expected_autoAssign opposite to actual_autoAssign in both states.

Additional context

  • distributed/src/main/java/com/orientechnologies/orient/distributed/db/OrientDBDistributed.java:339 / :343 — the autoAssignAllocation() condition is isQuorumOnline && isOnline && isSynching
  • distributed/src/main/java/com/orientechnologies/orient/distributed/context/coordination/dbs/ODatabaseTopologyState.java:531-532 — isSynching() returns !this.syncSessions.isEmpty()
  • The change that introduced this gate is titled fix: avoid to rebalance allocation if sync is happening (git show 894d3f878d), but it added a positive isSynching() requirement instead of a negative guard.

Suggested fix: negate the condition (&& !databaseTopology.isSynching(dbId)) or restructure the guard to skip rebalance when a sync session exists. Add a unit test that fixes isQuorumOnline/isOnline and asserts the branch for both isSynching values.

Scope note: no multi-node sync topology was built; the defect is confirmed by the current-source truth table and a bounded control query. The runtime is 3.2.55 and the source is the current develop.

Dominant language
Java
Stars
5k
Forks
871
Avg merge
20h 9m
Merged PRs (30d)
31

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.