Skip to content

Commit 32c4247

Browse files
committed
core: failed to start if box.info.replication with gaps
The iterator in `queue/queue/abstract/queue_state.lua:49` does not handle the case where there are no records in the box.info.replication table in case of deleting old records, for examle: ``` - 1: id: 1 uuid: 77f30d9a-d344-4f7a-a18c-578fb5ec2540 lsn: 4 name: null 3: id: 3 uuid: 0ce528ca-ea35-42be-96b5-35ba610f9a3e lsn: 0 downstream: status: follow idle: 0.14953243732452 vclock: {1: 4} lag: 0.0015106201171875 name: null ``` It leads to the error and unable to start queue: ``` queue_state.lua:50: attempt to index a nil value ```
1 parent 2292cf0 commit 32c4247

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
### Fixed
1515

1616
- Grant method was added for `*_ready_buffer` spaces (#237).
17+
- Attempt to index a nil value if box.info.replication array has gaps.
1718

1819
## [1.4.2] - 2024-08-10
1920

queue/abstract/queue_state.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ local function max_lag()
4747
local n_replica = table.maxn(box.info.replication)
4848

4949
for i = 1, n_replica do
50-
if box.info.replication[i].upstream then
51-
local lag = box.info.replication[i].upstream.lag
50+
local replica = box.info.replication[i]
51+
if replica and replica.upstream then
52+
local lag = replica.upstream.lag
5253
if lag > max_lag then
5354
max_lag = lag
5455
end

0 commit comments

Comments
 (0)