Skip to content

Clarify HostDBInfo state#13092

Open
masaori335 wants to merge 1 commit intoapache:masterfrom
masaori335:asf-master-cleanup-hostdbinfo-0
Open

Clarify HostDBInfo state#13092
masaori335 wants to merge 1 commit intoapache:masterfrom
masaori335:asf-master-cleanup-hostdbinfo-0

Conversation

@masaori335
Copy link
Copy Markdown
Contributor

Summary

Replaces the "alive/dead/ombie" terminology in HostDBInfo with an explicit three-state model, "up/down/suspect", and cleans up the API surface.

HostDBInfo State

State Description
Up No known failure; eligible for normal selection.
Down Blocked; no connections permitted until _last_failure + fail_window elapses.
Suspect Fail window has elapsed; connections are permitted. On success transitions to Up; on failure returns to Down.

Changes

HostDBInfo class

  • Converts struct to class with private _last_failure / _fail_count fields
  • Adds State enum (UP, DOWN, SUSPECT) and a canonical state(now, fail_window) method
  • Sugar helpers is_up(), is_down(now, fail_window), is_suspect(now, fail_window) for call-site clarity
  • mark_down(now, fail_window) now handles both UP→DOWN and SUSPECT→DOWN transitions; the latter refreshes the fail window by updating _last_failure
  • increment_fail_count takes fail_window so it can delegate to the updated mark_down
  • Moves all method implementations out of the header and into HostDBInfo.cc

Documentation

  • Replaces "zombie" with "suspect" throughout hostdb.en.rst

Tests

  • New test_HostDBInfo.cc with unit tests covering all state transitions including concurrent CAS races and full UP→DOWN→SUSPECT→DOWN→SUSPECT→UP cycles

@masaori335 masaori335 added this to the 11.0.0 milestone Apr 16, 2026
@masaori335 masaori335 self-assigned this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant