Commit Graph

27 Commits

Author SHA1 Message Date
Paul Lorenz 9595e10cfa Replicate link state over gossip. Fixes #3726
A router reported its links to every controller, and each controller kept its own
picture built only from what routers told it directly. That does not survive
routers being connected to a subset of controllers: a controller learns nothing
about links whose routers it does not hold a connection to.

Link state now lives in the replicated store: a router reports to one controller,
that controller writes the entry it owns, and the mesh carries it to the rest.
Each link entry is owned by the router that dialled it, so two controllers never
contend for the same key, and a controller that has never spoken to a router
still converges on its links.

- registers a link state type on the gossip store and carries link add, update
  and removal through it
- makes a link's source router an atomic and repoints it when the router
  connects, since a link can be built from a gossiped entry before its router has
  connected here, leaving a database-loaded placeholder as the endpoint
- reconciles a reconnecting router's gossip entries, marking its links usable
  again rather than removing them, since a disconnect sets them down instead of
  deleting them
- tombstones a link on disconnect in single-controller mode, where there is no
  peer to learn the removal from
- adds the gossip transport: peer handlers on the controller mesh, router-facing
  gossip handlers, digest exchange off the receive goroutine, and the pools that
  bound apply and I/O work
- has the digest exchange restamp a key the controller holds a higher version
  for, above that version, and send the live value. A router's Lamport clock is
  in memory, so a restart returns it to zero while the controller still holds
  versions from the previous incarnation under the same key. Link metrics are
  keyed by link id alone, and that id belongs to the dialer, so an acceptor's
  restart leaves the key unchanged and its republishes are refused as older.
  Keeping the stored version sends nothing, and every later digest reaches the
  same answer, so the exchange that exists to repair divergence would instead
  hold it in place. Safe because the router is the sole writer of the keys it
  advertises: it takes the clock from a digest but never a value
- advertises a gossip capability so a router reports to one controller only once
  every controller can replicate, and falls back to reporting to all until then
- adds canaries, a per-router sequence carried over the same path, so a router
  can tell that a controller has stopped applying its state
- carries link metrics over gossip alongside the state
- keeps the disconnect teardown's reroute ordering: the currency guard wraps it,
  and inside, the link snapshot and MarkDisconnected stay ahead of the cascade so
  reroute cannot path through the router being removed
2026-09-03 12:39:57 -04:00
Paul Lorenz 187aa11f24 Own the metrics wire format in ziti. Fixes #4036
- adds a common/servermetrics package that owns the metrics MetricsMessage wire
  format and the reporting/usage subsystem (message builder, usage registry,
  interval and usage counters), wrapping the openziti/metrics Registry for
  metric collection
- moves the controllers metrics reporter into the router package and removes it
  from the shared metrics package, breaking a common -> router/env import cycle
- repoints controller and router consumers to common/servermetrics; base metric
  collection stays on openziti/metrics
- keeps the proto field numbers and the metrics content-type identical so the
  encoding is byte-compatible across the move, and uses a distinct proto package
  name so ziti's and the library's messages coexist without a global proto
  registry clash
- adds a round-trip test asserting wire compatibility with the library's
  MetricsMessage
- leaves openziti/metrics unchanged, so sdk-golang and the shared xgress data
  plane are unaffected
2026-06-29 22:37:25 -04:00
Paul Lorenz ae806045b5 Convert self-describing receive handlers to channel/v5. For #3983
- channel.TypedReceiveHandler -> channel.ContentTypeReceiver
- binding.AddTypedReceiveHandler(h) -> channel.AddReceiveHandlers(binding, h)

channel/v5 repurposes TypedReceiveHandler for the senders-typed handler and replaces the
self-describing pattern with ContentTypeReceiver plus the AddReceiveHandlers free function
(openziti/channel#262). Mechanical conversion; does not build on its own.
2026-06-18 12:51:02 -04:00
Paul Lorenz 1c122af490 Rewrite channel/v4 imports to channel/v5. For #3983
- moves the channel dependency to channel/v5 v5.0.10 and sdk-golang to v1.9.0 in the root and zititest modules
- mechanically rewrites every channel/v4 import path to channel/v5

This is the import-path-only step; the API-level changes the switch requires land in the following commit. This commit does not build on its own.
2026-06-18 12:51:02 -04:00
Paul Lorenz a785ab41fb Fix potential deadlock if panic while lock held 2026-04-06 09:56:43 -04:00
Paul Lorenz 588cb2350c Fix data race on heartbeat lastResponse and peer logger label
- changes lastResponse from plain int64 to atomic.Int64 in both router
  and peer heartbeat callbacks, fixing a data race between the heartbeat
  response handler and the heartbeat check ticker
- fixes peer heartbeat logger channelType from "router" to "peer"
2026-04-03 17:42:18 -04:00
Paul Lorenz c9694ce3aa Update controller peer error marshalling for app code changes. Fixes #3747 2026-04-02 22:46:28 -04:00
Paul Lorenz da9ef76d19 Optimize imports 2026-01-28 15:01:35 -05:00
Paul Lorenz 2ffc6e1151 Update ziti version to 2.0 2026-01-28 12:34:10 -05:00
Paul Lorenz ffe6e16b76 Separate raft command submission limiting from in-flight limiting. Fix some create terminator error handling. Fixes #3318 2025-12-03 17:01:28 -05:00
Paul Lorenz 2096535abe Add missing shutdown logic 2025-09-18 15:33:45 -04:00
Paul Lorenz e647d67325 Update to channel/v4 2025-04-02 15:28:59 -04:00
Paul Lorenz f103154542 Support joining to a cluster from an unattached node. Fixes #2543 2024-11-15 08:26:27 -05:00
Paul Lorenz 32eddd61ca HA SDK terminators test. Fixes #2217. Fixes #2533 2024-11-12 18:45:08 -05:00
Paul Lorenz 6e1983991d Fixes from testing 2024-11-01 15:21:01 -04:00
Paul Lorenz 16f0a858e6 Add controller connect events. Fixes #1835. Fixes #2234 2024-11-01 15:21:01 -04:00
Paul Lorenz cccf0c06af Update to channel/v3. Fixes #2390 2024-09-09 12:23:25 -04:00
Paul Lorenz e8c69453cb Fix transfer leadership. Fixes #2343 2024-08-22 09:08:16 -04:00
Paul Lorenz 0298baa916 Fix record not found unmarshall. Fixes #1983 2024-04-25 14:24:56 -04:00
Paul Lorenz 898e41ae2a Implement router data model changesets. Fixes #1966 2024-04-23 11:56:10 -04:00
Paul Lorenz f3d67b7f49 Update fabric imports 2023-09-28 23:34:28 -04:00
Paul Lorenz 8cc424183c Do some HA config tidying 2023-08-22 20:36:29 -04:00
Paul Lorenz cdfd037da9 Move protobuf definitions to common 2023-08-10 19:38:48 -04:00
Paul Lorenz 13fc2a12c1 Move metrics package to common 2023-08-10 18:08:06 -04:00
Paul Lorenz 820e6391a4 Add heartbeat config and controller peer heartbeats. Fixes openziti/fabric#507
Adds config to controller for heartbeat config
Add config to routers for heartbeat config
Adds configurable heartbeats to controller <-> controller connections
2023-02-28 09:47:53 -05:00
Paul Lorenz 82b3b8b742 Add transfer-leadership command. Fixes openziti/fabric#599 2023-02-17 12:55:10 -05:00
Paul Lorenz abb0eb96fb Add more raft configuration options. Fixes openziti/fabric#597
Add more raft config knobs
Refactor peer handles to be consistent with other handlers
Allow inspect to work across controllers
Add config and clusterconfig inspect support
2023-02-15 23:47:57 -05:00