Skip to content

Clarify HostDBInfo state#13092

Open
masaori335 wants to merge 2 commits intoapache:masterfrom
masaori335:asf-master-cleanup-hostdbinfo-0
Open

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

Conversation

@masaori335
Copy link
Copy Markdown
Contributor

@masaori335 masaori335 commented Apr 16, 2026

Summary

Replaces the "alive/dead/zombie" 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 full UP→DOWN→SUSPECT→DOWN→SUSPECT→UP cycles

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors HostDB per-target health tracking by replacing the previous “alive/dead/zombie” terminology with an explicit 3-state model (UP/DOWN/SUSPECT), updating call sites and documentation, and adding unit tests around the new transition behavior.

Changes:

  • Refactors HostDBInfo into a class with private failure-tracking fields and a canonical state(now, fail_window) API plus helpers.
  • Updates host selection / health update call sites to use is_down(...), is_up(), and mark_active_server_up() naming.
  • Adds new Catch2 unit tests and wires them into the HostDB build when BUILD_TESTING is enabled; updates HostDB developer documentation terminology.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/proxy/http/HttpSM.cc Updates HostDB health update calls (mark_active_server_up, new increment_fail_count signature).
src/mgmt/rpc/handlers/hostdb/HostDB.cc Adjusts RPC YAML encoding to use new HostDBInfo accessors.
src/iocore/hostdb/unit_tests/test_HostDBInfo.cc Adds unit tests for UP/DOWN/SUSPECT transitions and fail window behavior.
src/iocore/hostdb/unit_tests/CMakeLists.txt Adds a dedicated unit test executable for HostDBInfo.
src/iocore/hostdb/HostDBInfo.cc Implements the new HostDBInfo state model and transition methods.
src/iocore/hostdb/HostDB.cc Updates RR selection logic to use new health helpers (is_down, is_up).
src/iocore/hostdb/CMakeLists.txt Includes the new unit_tests subdirectory under BUILD_TESTING.
include/iocore/hostdb/HostDBProcessor.h Public API surface changes for HostDBInfo and ResolveInfo helpers; updated docs/comments.
doc/developer-guide/core-architecture/hostdb.en.rst Replaces “zombie” terminology with “suspect” and updates behavioral description.

Comment thread include/iocore/hostdb/HostDBProcessor.h Outdated
Comment thread src/iocore/hostdb/unit_tests/test_HostDBInfo.cc Outdated
Comment thread src/iocore/hostdb/unit_tests/test_HostDBInfo.cc Outdated
Comment thread src/iocore/hostdb/unit_tests/test_HostDBInfo.cc
Comment thread src/iocore/hostdb/HostDBInfo.cc Outdated
Comment thread src/iocore/hostdb/HostDBInfo.cc Outdated
@bryancall bryancall requested a review from bneradt April 20, 2026 22:34
@masaori335 masaori335 removed this from ATS v10.2.x Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants