Skip to content

M7: the failover cases wait for the producer on both segments - #52

Open
merlimat wants to merge 1 commit into
mainfrom
m7-failover-flake
Open

merlimat wants to merge 1 commit into
mainfrom
m7-failover-flake

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

Problem

conformance::failover_by_unload (from #45) can fail on a slow host, and when it does, its message hides the cause. It starts the failover after 20 sends, then waits at most 30 s for the topic's stats to list the producer on both segments, and asserts on the failover thread. In one local full run, made while five other builds shared the host (it took 400 s instead of about 145 s), the stats listed no producer for the whole 30 s. The thread panicked before the unload; the clients carried on for five more minutes, and the case failed with "the failover did not complete". The producer wasn't stuck: all 6000 sends completed without an error. So either its first registrations on the fresh namespace took over 30 s, or the stats lagged behind them; the case couldn't tell which.

Example

thread '<unnamed>' panicked at crates/apache-pulsar/tests/integration/conformance.rs:356:21:
assertion `left == right` failed: the producer on each segment: {}
  left: 0
 right: 2
...
---- conformance::failover_by_unload ----
test panicked: the failover did not complete

from the failover thread:

let deadline = Instant::now() + Duration::from_secs(30);
let before = loop {
    let before = producers(env, path);
    if before.len() == 2 || Instant::now() > deadline {
        break before;
    }
    std::thread::sleep(Duration::from_millis(200));
};
assert_eq!(before.len(), 2, "the producer on each segment: {before:?}");

Change

  • Both failover cases wait until a send to each segment has completed, for up to 120 s, before the topic fails over. The unload then waits up to 60 s for the stats to list the producer on both segments.
  • If a wait runs out, the case records why, stops its clients and fails at once with the reason. For example: the topic couldn't fail over: sends completed on both segments ({0: 12, 1: 9}), but in 60 s the topic's stats listed its producers as {}. A send that never completes no longer holds the case up.
  • tests/conformance/README.md says when the failover starts.

Testing

Against apachepulsar/pulsar:5.0.1:

  • Both failover cases passed 3 runs of 3. They also passed 2 runs of 2 with two CPU burners per core on the host, the unload in about 15 s each time.
  • The whole integration suite passed once.
  • With the first wait broken on purpose (5 s, sends on 3 of 2 segments), the case failed after 10 s: the topic couldn't fail over: in 120 s, sends completed on 2 of 2 segments: {0: 71, 1: 48}. Only the deadline was changed, not the message.

cargo fmt, and clippy with Rust 1.100 on the integration target, which CI's clippy skips (-A clippy::type_complexity, as its other modules need). Only test code changes.

conformance::failover_by_unload failed once locally, on a host busy with other builds: the
topic's stats listed no producer within 30 s, the failover thread panicked before the unload,
and the clients carried on for five more minutes before the case failed with "the failover did
not complete". Both failover cases now wait until a send to each segment has completed (up to
120 s), and the unload until the stats list the producer on both segments (up to 60 s). A wait
that runs out stops the clients and fails the case at once, saying what was missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant