Skip to content

Commit

Permalink
Preserve LastComputeSeqNum if 0 (#4775)
Browse files Browse the repository at this point in the history
Only update LastComputeSeqNum if greater than 0, as zero can indicate
either no messages processed yet or a connection that has just been
established. This preserves the existing sequence number in those cases.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced node management with improved health monitoring and state
persistence.
- Added conditional logic to prevent overwriting sequence numbers with
zero.
- Improved handling of disconnected nodes to retain existing connection
states.

- **Bug Fixes**
- Adjusted control flow and error handling for better robustness in node
state updates.

- **Documentation**
- Added logging statements for improved visibility into state
transitions and error conditions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
wdbaruni authored Dec 16, 2024
1 parent 9135124 commit 6d61b6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/orchestrator/nodes/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,13 @@ func (n *nodesManager) resolveStartingOrchestratorSeqNum(
// We should implement proper comparison logic to ensure sequence numbers only advance forward.
func (n *nodesManager) updateSequenceNumbers(state *models.ConnectionState, orchestratorSeq, computeSeq uint64) {
state.LastOrchestratorSeqNum = orchestratorSeq
state.LastComputeSeqNum = computeSeq

// Only update LastComputeSeqNum if greater than 0, as zero can indicate
// either no messages processed yet or a connection that has just been
// established. This preserves the existing sequence number in those cases.
if computeSeq > 0 {
state.LastComputeSeqNum = computeSeq
}
}

// enrichState adds live tracking data to a node state.
Expand Down

0 comments on commit 6d61b6f

Please sign in to comment.