apache / apache/pulsar-client-cpp

Add cluster-level automatic failover support (AutoClusterFailover)

Aperta
#568 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
71
Fork
90
Merge medio
2h 33m
PR unite (30g)
3

Descrizione

**Summary**

The C++ client does not support cluster-level failover — the ability for a Pulsar client to automatically switch from a primary cluster to a secondary cluster when the primary becomes unavailable.

**Context**

The Java client has supported this since Pulsar 2.10 (May 2022) via `AutoClusterFailover` and `ControlledClusterFailover`, both built on the `ServiceUrlProvider` abstraction. The .NET client (Pulsar.Client) has also independently implemented equivalent functionality via `IServiceInfoProvider`. The C++ client still lacks this capability. Since the C++ client is the foundation for several language bindings (Node.js, Python), this gap propagates across multiple client ecosystems. Adding cluster-level failover here would bring the C++ client to parity with Java and unblock the same capability in downstream clients.

**Proposed Behavior**

1. A `ServiceUrlProvider` (or equivalent) abstraction that allows pluggable URL resolution.
2. An `AutoClusterFailover` implementation that:
- Accepts a primary service URL and one or more secondary service URLs.
- Runs a background probe task at a configurable `checkInterval` (default: 30s).
- Switches to the first healthy secondary if the primary is unreachable for longer than `failoverDelay` (default: 30s).
- Switches back to the primary once it recovers and stays healthy for `switchBackDelay` (default: 60s).
- Supports per-cluster authentication and TLS configuration.

**Use Case**

Pulsar deployments with geo-replication across multiple regions need producer clients to automatically failover to a secondary cluster when their local cluster becomes unavailable, without requiring DNS-level failover or application-level detection logic.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia confrontando le implementazioni Java di AutoClusterFailover e ControlledClusterFailover e il design .NET di IServiceInfoProvider menzionato nell'issue. Definisci l'astrazione C++ ServiceUrlProvider e il comportamento di failover, inclusi i controlli dello stato, i ritardi, l'autenticazione e TLS; il lavoro è completato quando il passaggio dal primario al secondario e il ripristino sono coperti da test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
distributed-systems, networking
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.