Wiki Reference
Control-plane gRPC API
Every service, RPC, field and refusal code on a Mirexa node's gRPC control listener, and how it is exposed and authenticated.
A Mirexa node can serve a gRPC control listener beside its data listener. Data — candles and ticks — never travels over it: ingest, queries and subscriptions use the binary wire protocol. The control listener carries low-rate administration instead: a node's stream catalog and trading calendars, its status, and, on a clustered node, the replicated cluster state (node registry, partition directory, migrations, cluster settings). It is gRPC because those operations are schema-heavy and want additive evolution, which is what protobuf is good at.[1]
This page is the reference for every service and RPC on that listener, how it is exposed, how it is authenticated, and what each call answers when it refuses. For what the control plane is and why it is built on Raft, read The control plane.
The listener
| Setting | Default | Meaning |
|---|---|---|
control. |
false |
Turns the listener on. Off by default: a node does not start exposing an administrative surface because it was upgraded. |
control. |
127. |
Listen address. Loopback by default. |
control. |
false |
Registers gRPC server reflection, so grpcurl can discover the schema without a compiled stub. Off by default because it publishes the whole surface. |
control. |
false |
Serves the listener with the data plane's TLS configuration (one certificate, one reload path). Requires security.; there are no separate certificate settings. |
control. |
false |
Requires an ADMIN_ token on every call — see Authentication. |
control. |
10s |
How long a graceful stop waits for in-flight RPCs before closing them. |
Defaults are from config.Default and the field docs on ControlConfig.[2] Every
call is logged (method, duration, gRPC code; failures at WARN) and counted in
mirexa_control_rpcs_total{method,code}.[3] The interceptor chain is
unary-only, and every RPC on this listener is unary.
Which services are registered
| Service | Registered when |
|---|---|
mirexa. |
always (when the listener is on) |
mirexa. |
always |
mirexa. |
only when cluster. is true |
grpc. |
only when control. is true |
On a single node ClusterService is absent, not present-and-refusing: a client calling
it gets gRPC UNIMPLEMENTED (unknown service), and cannot mistake a single node for a
cluster that is down.[4] TestControlServer_ServiceSurfaceIsPinned pins the exact
set in both build shapes, so adding a service to this listener is a deliberate change.
The loopback rule
ClusterService can fence any node and reassign any partition, and StreamService can
delete a stream and rewrite its calendar, so the server refuses to serve the listener
unauthenticated on a reachable address. When control.admin_auth is off,
control.addr must be loopback, clustered or not, and the node fails to start
otherwise (control.ErrControlAPINotLoopback).[5] Specifically:
control. host |
Without admin_ |
|---|---|
a loopback IP literal (127., :) |
allowed |
localhost |
allowed (the one hostname accepted) |
empty (:, every interface) |
refused |
| any other hostname | refused — not resolved, because a name can resolve differently later |
| a routable IP | refused |
With control.admin_auth on, any address is allowed. Exposure and authentication are one
decision on purpose: of the four combinations, only "reachable and unauthenticated" is a
disaster, and it is now unrepresentable.
Transport privacy is a separate setting: admin_auth authenticates the caller but does not
encrypt the wire. On a routable address, also set control.use_tls.
Authentication
With control.admin_auth: true, every method on the listener — StreamService and
NodeStatusService included — requires a credential; there is no exemption list.[6]
- The credential is a Mirexa session token, the same Ed25519-signed token the data
plane accepts, minted offline by
mirexa-cli tokenand carrying theADMIN_CLUSTERpermission bit (bit 6). See Permissions. - Where it goes: gRPC metadata key
authorization, valueBearer <token>. The scheme is matched case-insensitively. Exactly one value: twoauthorizationentries are refused rather than one picked. - Verified against
security.auth.trusted_keys, the same keys the data plane uses. Turningadmin_authon with no trusted keys is a startup failure (control.ErrNoAdminKeys), not a server that refuses every call.
mirexa-cli token issue -key admin.key -perms ADMIN_CLUSTER -validity 30m > admin.token
grpcurl -H "authorization: Bearer $(cat admin.token)" -plaintext \
127.0.0.1:9090 mirexa.control.v1.ClusterService/GetClusterStatus
(grpcurl needs control.reflection: true, or the .proto file passed with -proto.)
The order of checks, and the code each failure returns:[7]
| Step | Failure | Code | Message |
|---|---|---|---|
metadata present, one authorization value, Bearer scheme |
missing / two values / other scheme | UNAUTHENTICATED |
no admin credential, more than one admin credential, admin credential is not a bearer token |
| token decodes | not a valid token | UNAUTHENTICATED |
admin credential is malformed (the parse error is not echoed) |
| signature verifies against a trusted key | unknown or bad signature | UNAUTHENTICATED |
admin credential is not signed by a trusted key |
the data plane's admission rule, after the signature (every other field is attacker-supplied until it verifies): signing key not revoked, not expired, expiry no more than one hour ahead (wire.), no undefined permission bits |
revoked / expired / too long-lived / undefined bit | UNAUTHENTICATED |
admin credential is refused: |
the grant (the token's bits ∩ security.) holds ADMIN_ |
valid token, wrong permissions | PERMISSION_ |
admin credential lacks ADMIN_ |
carries the bit, but max_ does not grant it |
PERMISSION_ |
admin credential carries ADMIN_ |
UNAUTHENTICATED means "prove who you are"; PERMISSION_DENIED means "you did, and this
credential may not do this" — a different fix. A refused call is still logged and counted:
the auth interceptor runs last in the chain.
Go callers can attach the token with control.AdminCredential, a
grpc.PerRPCCredentials that does not require transport security (so it also works against
the default plaintext loopback listener).
An issuer key revoked through RevokeKey is refused here within one revocation sync
(250 ms of the node applying it), as it is on the data plane: the admin check reads the data
server's own revoked set.[7:1]
The routine clients of this API attach the token for you:
mirexa-cli's calendar, lineage, cache and gap commands take
-control, -token/-token-file (or $MIREXA_TOKEN) and -tls-ca; a joining cluster
node reads cluster.admin_token_file before every request, so the file can be rotated in
place.
StreamService
Administers this node's stream catalog: registration, trading calendars, lineage, hot
cache sizing and incomplete-bar marks. Calls act on the node you reach. On a cluster, send
calendar calls to the node that is primary of the stream's partition; copies take the
primary's metadata and gap list on every seed round.[8] (The data plane carries
equivalent stream-metadata frames under the ADMIN_STREAM permission — see
Wire protocol. This gRPC service is guarded by ADMIN_CLUSTER when
admin_auth is on, not by ADMIN_STREAM.)
Shared messages
StreamId — the stream identity, carried as components (the exchange:symbol:timeframe
rendering is not injective).
| Field | Type | Notes |
|---|---|---|
exchange |
string | required |
symbol |
string | required |
timeframe |
string | required, e.g. 1m, 1h, 1d |
Each component must be non-empty and must not contain :, / or NUL, or the call is
INVALID_ARGUMENT.[9]
StreamMetadata — a stream's calendar and per-stream settings.
UpdateStreamMetadata replaces the whole record: read it with GetStream, edit, send
it back, or the calendar is cleared.
| Field | Type | Notes |
|---|---|---|
gap_ |
int64 | shortest gap recorded at all |
gap_ |
int64 | on a stream without working hours, a gap at least this long is filed as a closure (OFF_) |
custom_ |
map<string,string> | stored, no effect on behaviour |
has_ |
bool | output only |
working_ |
WorkingHours |
weekly schedule; absent = 24/7 |
closures |
repeated Closure |
declared closures, stored sorted and merged |
lineage |
Lineage |
output only; written by SetStreamLineage alone |
cache_ |
uint32 | output only; the hot-cache override, written by SetStreamCache alone (0 = none) |
WorkingHours: timezone (IANA name, empty = UTC), days (repeated DaySchedule).
DaySchedule: weekday (monday…sunday, case-insensitive), windows (repeated
"HH:MM-HH:MM"; several express a lunch break). A weekday with no entry is closed.
Closure: start_nanos, end_nanos (the range [start, end), Unix ns), note
(at most 256 bytes).
Lineage — what a derived stream's candles come from
(Derived streams).
| Field | Type | Notes |
|---|---|---|
source |
StreamId |
same exchange and symbol as the target |
kind |
string | "ticks" or "candles" |
close_ |
int64 | how late source data still joins a bar; 0 = 1s |
no_ |
int64 | tick sources only; longest silence that is not missing data; 0 = 10s |
since_ |
int64 | output only: when the derived stream begins |
rederive_ |
bool | output only: a history re-derivation is still walking |
LineageHistory: LINEAGE_HISTORY_FROM_NOW (derive what arrives from now) or
LINEAGE_HISTORY_REDERIVE (also derive the source's existing history).
StreamSummary: stream_id, partition_id (the partition the stream hashes to on this
node), metadata, effective_cache_capacity (the hot-cache size in slots this node uses:
the override, or the size derived from the timeframe).
GapRecord: start_nanos, end_nanos, status and reason as names (OPEN,
ACCEPTED, …; INCOMPLETE, NETWORK, …).
RPCs
| RPC | Request | Response | Behaviour |
|---|---|---|---|
RegisterStream |
stream_, metadata |
stream, created |
Idempotent: an existing stream's metadata is updated and created is false. Storage directories are created before the metadata is recorded. Lineage and cache override are kept. |
GetStream |
stream_ |
stream |
NOT_ if not in this node's catalog. |
ListStreams |
page_, page_, exchange, symbol_, timeframe |
streams, next_ |
Key-set paging in (exchange, symbol, timeframe) order. page_ 0 = 100, capped at 1,000. The token is opaque and encodes the last entry returned, not an offset, so registrations or deletions between pages never repeat or skip an entry; a token the server did not mint is INVALID_. Empty next_ = last page. |
UpdateStreamMetadata |
stream_, metadata |
stream, refiled_ |
Replaces the metadata of a known stream (does not create). Already-filed gaps are re-filed under the new calendar before it returns; refiled_ is how much gap changed classification. A gap since filled with data is never touched. |
DeleteStream |
stream_ |
removed_ |
Removes the catalog entry only. Chunks, WAL records and indexes stay on disk; this is not a purge. A later write to the stream registers it again. |
AddStreamClosure |
stream_, closure |
stream, refiled_ |
Declares a closure (holiday, halt, or an outage the operator accepts as a closure) and re-files. |
RemoveStreamClosure |
stream_, start_, end_ |
stream, refiled_ |
Removes a range from the declared closures, cutting any closure it overlaps, and re-files. |
SetStreamLineage |
stream_, lineage, history |
stream |
Declares, replaces or (with lineage absent) clears the stream's lineage. history is required when declaring. Clearing stops derivation and deletes nothing. |
SetStreamCache |
stream_, cache_ |
stream |
Sets the hot-cache size override, 16 to 8,388,608 slots; 0 clears it. The running stream takes it before the call returns (a cache holding data is drained to a chunk and rebuilt). |
AcceptGap |
stream_, gap_, accept |
gap |
Marks a derived bar's INCOMPLETE mark ACCEPTED (accept:) or puts it back to OPEN. The start must match a mark exactly as listed. |
Refusal codes:[10]
| Code | When |
|---|---|
INVALID_ |
missing or malformed stream_; bad metadata (an unparseable window, timezone, …); bad lineage kind or source; history unset on a lineage declaration; cache capacity out of range; closure missing; a page token the server did not mint |
NOT_ |
stream not in this node's catalog; AcceptGap naming a start no gap has |
FAILED_ |
AcceptGap on a gap that is not an incomplete mark, or in the wrong status |
INTERNAL |
storage failure, or any other error |
Gap classification and calendars are explained in
Gaps and trading calendars; the CLI front end is
mirexa-cli calendar|lineage|cache|gap.
NodeStatusService
What this node is and how it is doing. Prometheus metrics are not repeated here; they
are on the observability server's /metrics (Metrics).
| RPC | Response fields | Notes |
|---|---|---|
GetNodeStatus |
version, uptime_, ready (the same health manager as /), stream_ (this node's catalog), partition_ (the layout's), data_ |
Cheap. |
GetStorageStats |
total_ (every file under storage., WAL and Raft log included), stream_ |
Walks the data directory at call time — O(files), honours cancellation. Do not poll it in a tight loop. |
Both requests are empty. The only refusal besides auth is INTERNAL (or the context's own
code) from a failed walk.
ClusterService
The administrative surface over the cluster state replicated by Raft: the node registry,
the partition directory, migration intents, cluster settings and revoked issuer keys.
Nothing here reads or writes candle data. Registered only when cluster.enabled.
Leaders, followers and reads
Only the Raft leader can apply an entry, so a mutating RPC on a follower fails with
FAILED_PRECONDITION, message this node is not the control-plane leader, and a typed
error detail mirexa.control.v1.NotLeader:[11]
| Field | Type | Meaning |
|---|---|---|
leader_ |
uint64 | current leader, 0 when none is known |
leader_ |
string | the leader's Raft address — not a control endpoint; not filled by the current code |
leader_ |
string | the leader's control address, read from this node's local registry; empty while the leader is not registered |
The server does not forward; the caller retries at leader_control_addr (or its seed
list when that is empty). FAILED_PRECONDITION rather than UNAVAILABLE is deliberate:
gRPC clients retry UNAVAILABLE against the same address, which cannot succeed. Read the
detail with status.FromError(err).Details(); classify by the typed detail, never by message
text.
notLeaderErrorsets onlyleader_node_idandleader_control_addr;leader_raft_addris declared in the proto but left empty (read fromClusterService.notLeaderError).
Reads are linearizable unless stated otherwise, and therefore also leader-only: on a
follower they return the same NotLeader refusal. hashicorp/raft has no read index, so a
linearizable read is a Barrier plus a local read, which appends an entry to the Raft
log. These reads are operator-rate; do not poll them in a tight loop.[12] The
exceptions:
| RPC | How it is answered |
|---|---|
GetClusterStatus |
Locally, no barrier, no quorum: this replica's own view. It is the call to make when the cluster is unhealthy. |
GetRebalancePlan |
From the leader's last periodic evaluation held in memory; plans nothing per request. A follower holds no load view and answers an empty plan. |
Heartbeat |
Leader-only, but verifies leadership with a quorum round that appends nothing, then reads the registry locally. Never a log entry. |
Outcomes common to every mutating RPC
A mutation is proposed through Raft with a fixed 10-second deadline (not configurable). Its outcome maps to:[13]
| Outcome | Code | What to do |
|---|---|---|
| applied | OK | — |
| the cluster agreed and the state machine declined it (any rule: unknown node, wrong incarnation, partition out of range, version mismatch, immutable setting, already draining, …) | FAILED_, message <op> was refused by the control- |
Read the state. The specific rule is not carried back — a Raft result is a number. Do not retry blindly: the decision is final. |
| not the leader | FAILED_ + NotLeader |
Retry at the leader. |
| may or may not have been applied (timeout, cancellation, lost leadership mid-commit) | UNKNOWN, message … may or may not have been applied; read the state back rather than retrying |
Reconcile by reading back. Never blind-retry. |
| consensus not running on this node | FAILED_, consensus is not running on this node |
— |
| proposal did not happen (other library error) | UNAVAILABLE |
Safe to retry. |
| entry could not be applied on this replica | INTERNAL, … it may have diverged from its peers |
Investigate the node. |
| malformed request (required field zero, …) | INVALID_ |
Checked before consensus, so nothing reaches the log. |
There is no per-sentinel mapping from the cluster package's refusal errors to gRPC codes:
every state-machine refusal is the one FAILED_PRECONDITION above. The exceptions with
their own codes or details are named per RPC below. A successful mutation is followed by a
linearizable read, so the response carries what the cluster holds (an assigned
incarnation, a settled epoch, a derived migration source), not an echo of the request.
Shared messages
NodeStatus: NODE_STATUS_ONLINE (1), LEAVING (2, draining), OFFLINE (3, fenced),
OFFLINE_LEAVING (4, fenced while draining), DECOMMISSIONED (5, drain finished and out
of the consensus group; registration refuses it).
ClusterNode
| Field | Type | Meaning |
|---|---|---|
node_ |
uint64 | |
raft_ |
string | consensus transport address |
data_ |
string | wire-protocol listener; what a REDIRECT names |
status |
NodeStatus |
|
incarnation |
uint64 | log index of the registration that created this record; a fence must name it |
control_ |
string | this node's control listener |
replication_ |
string | the inter-node replication listener; empty if it serves none |
PartitionAssignment
| Field | Type | Meaning |
|---|---|---|
partition_ |
uint32 | |
primary |
uint64 | the one node that accepts writes |
secondary_ |
repeated uint64 | copies |
in_ |
repeated uint64 | caught-up subset; always includes the primary |
epoch |
uint64 | the fencing token: log index of the entry that installed the current primary; moves only when the primary changes |
divergent_ |
repeated uint64 | nodes holding a history a failover abandoned; never a live copy |
MigrationStatus: partition_id, source_node_id, target_node_id, step
(MigrationStep), kind (MigrationKind). The step is derived from the directory on
every read, never stored:
MigrationStep |
Meaning |
|---|---|
NEEDS_ (1) |
target holds nothing yet; next it is added as a secondary |
CATCHING_ (2) |
target is seeding; the next move is the target's own |
READY_ (3) |
target is in sync and may run the cutover |
DRAINING_ (4) |
flip landed; source still holds the partition |
DONE (5) |
goal holds; intent about to be retired |
UNSATISFIABLE (6) |
the directory went somewhere this intent cannot reach; abandoned |
MigrationKind |
Meaning |
|---|---|
PRIMARY (1) |
move the primary: seed, cut over, flip, drop source |
SECONDARY (2) |
move one copy: add, catch up, drop source; never fewer copies |
SWAP (3) |
an in-sync copy becomes primary and the primary stays a copy; nothing copied |
Nodes
| RPC | Request | Response | Notes |
|---|---|---|---|
ListNodes |
status (optional filter) |
nodes |
Linearizable. |
GetNode |
node_ |
node |
Unset node when not registered — absence is an answer, not NOT_. |
JoinControlPlane |
node_, raft_ |
admitted_ |
Admits a node to the Raft group as a non-voter. A joining node calls it first, before building anything, and then waits until its own state has applied admitted_. Same id at the same address: admitted again, nothing written. Same id at a different address: ALREADY_. A timeout is plain UNAVAILABLE (admission is idempotent, so a retry is safe). |
RegisterNode |
node_, raft_, data_, control_ (all required), replication_ |
node |
Writes the registry record; a node calls it last at startup. Re-registering an ONLINE node is a restart and gets a fresh incarnation; a draining node comes back LEAVING. |
DrainNode |
node_ |
node |
Records the intent that a node leave: ONLINE → LEAVING, OFFLINE → OFFLINE_LEAVING. The leader then moves its primaries, then its copies, and decommissions it. A node already draining is refused. Watch with ListDrains. |
FenceNode |
node_, incarnation (both required) |
node |
Marks a node OFFLINE. Refused unless incarnation matches the registry's, so a fence cannot hit a node that restarted since you looked. |
DeregisterNode |
node_ |
empty | Removes the record. Refused for an unregistered or ONLINE node, while the directory still names the node, or while a migration targets it; deregistering a DECOMMISSIONED record is what makes its id reusable. |
A decommissioned node calling RegisterNode or JoinControlPlane is refused with
FAILED_PRECONDITION. Once it is out of the consensus group, and only from the leader, the
refusal carries a typed mirexa.control.v1.NodeDecommissioned{node_id} detail — the one
refusal a joining node treats as final (it then exits). Before that, or from a follower, it
is an ordinary retried refusal.[14]
Partitions
| RPC | Request | Response | Notes |
|---|---|---|---|
ListPartitions |
node_ (0 = all) |
partitions |
Non-zero node_: only partitions it holds as primary or secondary. |
GetPartition |
partition_ |
assignment |
Unset when the partition has no entry. |
AssignPartition |
partition_, primary (required), secondary_ |
assignment |
Replaces one entry. Moves the epoch only if the primary changes, and resets the in-sync set to the primary. The primary must be registered and ONLINE. Prefer MigratePartition: this does not move data. |
SetInSync |
partition_, in_ (non-empty) |
assignment |
Replaces the whole in-sync set. Does not move the epoch. Operator use; nodes use the next two. |
JoinInSync |
partition_, node_ |
assignment |
Adds one node to the in-sync set, touching no other member. A copy proposes it about itself. Joining a set it is in changes nothing. |
LeaveInSync |
partition_, node_ |
assignment |
Removes one node; the primary cannot leave. |
ReadmitDivergent |
partition_, node_ |
assignment |
Makes a node's divergent copy a syncing secondary. The node proposes it about itself after quarantining that copy; refused unless the node is divergent for the partition, and for a draining node. |
Migrations, drains, health and rebalancing
| RPC | Request | Response | Notes |
|---|---|---|---|
MigratePartition |
partition_, target_ (required) |
migration |
Records the intent to move the primary and returns at once; the leader's reconcilers carry it out. Poll ListMigrations. If the intent is already retired by the time it is read back, FAILED_. |
AbortMigration |
partition_, target_ (required) |
empty | Stops further steps. Undoes nothing: a seeded target keeps its data, and a cutover past its commit point still lands. Naming a target other than the current intent's is refused. |
ListMigrations |
— | migrations |
Every in-flight move with its derived step. |
ListDrains |
— | drains (DrainStatus: node_, status, primaries, copies, in_) |
A node leaves the list once all three counts reach zero and it is decommissioned. |
ListPartitionHealth |
impaired_ |
partitions (PartitionHealth) |
Projected from the directory and registry. impaired_ returns only partitions not SERVING. |
GetRebalancePlan |
— | moves, evaluated_ |
What the balancer would move, without moving it. Read from the leader's last evaluation, run every cluster.. FAILED_ before the first evaluation, when no leader is known, while the leader still lacks a node's load report or has not watched every node long enough to know its write rate — an empty plan in those cases would read as "balanced". Execute the moves you agree with through MigratePartition. |
PartitionHealth: partition_id, primary, epoch, state, copies (every node the
directory names, divergent ones included), live_copies (on ONLINE or LEAVING nodes, never
divergent), failover_candidates (in-sync secondaries on believed nodes, lowest id first).
PartitionHealthState |
Meaning |
|---|---|
SERVING (1) |
primary and every copy on believed nodes, none divergent |
UNDER_ (2) |
primary serving; a copy is on a fenced node or divergent |
PRIMARY_ (3) |
primary on a fenced node; an in-sync copy survives to fail over to |
UNAVAILABLE (4) |
no primary serving and no caught-up copy |
RebalanceMove: partition_id, from_node_id, to_node_id, bytes (the partition's
footprint on the source when planned — a cost estimate, not a promise), kind (PRIMARY
or SWAP).
Liveness and status
| RPC | Request | Response | Notes |
|---|---|---|---|
Heartbeat |
node_, incarnation, load (NodeLoadReport, optional), raft_ |
accepted, liveness_, state_ |
Sent by each node to the leader. Not a Raft proposal. accepted: (not an error) when the node is unregistered, at another incarnation, or fenced/decommissioned — the node must re-register. An accepted heartbeat licenses the node to serve as a primary for ¾ of liveness_ from its send time, once its own state reaches state_. A leader that has lost its quorum refuses heartbeats. |
GetClusterStatus |
— | local_, leader_, is_, term, voters, non_, commit_, applied_, last_, registered_, assigned_ |
Answered locally from this replica. There is no per-follower match index; lag is a subtraction across two nodes' commit_. |
NodeLoadReport: sampled_at_unix_nanos (the sender's clock), partitions (repeated
PartitionLoadReport: partition_id, streams, records, bytes, ingested — live
writes since the process started). All levels, never rates; a malformed report is logged on
the leader and the heartbeat still counts.
Cluster settings
ClusterSettings: partition_count (power of two), compression (codec for new
chunks), version, liveness_timeout_nanos, replication_factor.
| RPC | Request | Response | Notes |
|---|---|---|---|
GetClusterConfig |
— | settings |
Unset when the cluster has agreed on nothing yet. |
UpdateClusterConfig |
partition_, compression, expected_, liveness_, replication_ — all required (expected_ 0 seeds a fresh cluster) |
settings |
Compare-and-set: a stale expected_ is refused. partition_, liveness_ and replication_ are immutable once agreed — send back the values GetClusterConfig returned. In practice only compression can change. |
Revoked issuer keys
| RPC | Request | Response | Notes |
|---|---|---|---|
RevokeKey |
public_ (the 32 raw Ed25519 bytes) |
key (RevokedKey: public_, revoked_) |
Revokes a token issuer cluster-wide. Permanent and idempotent: revoked_ is the log index of the first revocation. Each node's data plane refuses the key within one 250 ms sync of applying the entry and cuts sessions it opened. Wrong length or all zeros: INVALID_. |
ListRevokedKeys |
— | keys |
Ascending by key. |
See Authentication and tokens for revocation as an operating procedure, and the note under Authentication above for its reach.
The replication service (internal)
A second gRPC service, mirexa.replication.v1.ReplicationService
(/proto/mirexa/replication/v1/replication.proto),
is how a partition's copies pull data from its primary. It is node-to-node only and is
not an API for clients or operators:
- It is served on its own listener,
cluster.replication_addr, never on the control listener. Setting that address requirescluster.replication_cert_file,replication_key_fileandreplication_ca_file; there is no plaintext mode, and the node refuses to start without all three.[15] - Callers authenticate with mutual TLS: a node certificate from the cluster CA
(
mirexa-cli certs), whose subject names the node id. Interceptors turn the verified certificate into a node id before any handler runs, for both streaming and unary RPCs. - Every request names the (partition, epoch) the caller believes; a node that is not that
partition's primary at that epoch refuses with a
NotPrimarydetail.
| RPC | Shape | Purpose |
|---|---|---|
Seed |
server-streaming | bulk-transfer a partition's flushed artifacts (chunks, index entries, gap lists, tick chunks) in their on-disk encoding |
Tail |
server-streaming | stream WAL records and install notices after a watermark, with heartbeats while idle |
Drain |
unary | freeze a partition for a cutover: writes shed, in-flight writes quiesced, everything flushed |
Resume |
unary | reopen a drained partition when a cutover fails before its commit point; only the draining node may call it |
FetchArtifact |
unary | hand one verified chunk to the other end of a primary–copy pair, to repair a chunk that rotted on the caller's disk |
How these are used is described in Replication and Reconciliation, scrubbing and repair.
References
Source
- /proto/mirexa/control/v1/control.proto — the schema; generated Go bindings in /internal/control/v1/ (
controlv1). control.NewServer,requireLoopback, the logging and metrics interceptorscontrol.AdminAuth.Verify,bearerFrom,adminAuthInterceptor,AdminCredentialcontrol.Service— StreamService and NodeStatusService,catalogError,streamIDFromProtocontrol.ClusterService—notLeaderError,propose,lookup,leaderLocalNode, node/partition/settings RPCsMigratePartition,AbortMigration,ListMigrations,ListDrains,ListPartitionHealth,GetRebalancePlan,RebalancePlan,RevokeKey,ListRevokedKeysconfig.ControlConfig,ClusterConfig.ReplicationAddrstartControlPlane,securityKeyring;startRevocationSync- mirexa-cli control client flags
- /proto/mirexa/replication/v1/replication.proto;
replication.NodeAuthStreamInterceptor,NodeAuthUnaryInterceptor;replication.Server.FetchArtifact
Tests
TestControlServer_ServiceSurfaceIsPinned,TestControlServer_ReflectionOnlyWhenEnabled,TestControlServer_TLSHandshake,TestControlServer_RecordsRPCMetrics,TestControlServer_LogsEveryRPC— /internal/control/server_test.goTestAdminAuth_UnauthenticatedAndDeniedAreDifferentCodes,TestAdminAuth_ExpiryIsCheckedAfterTheSignature,TestAdminAuth_TwoCredentialsAreRefusedRatherThanPicked,TestAdminAuth_RefusesToBuildWithNoKeys,TestAdminCredential_PresentsTheTokenTheServerExpects,TestControlServer_AdminAuthGuardsEveryMethod,TestControlServer_ARoutableAddressRequiresAdminAuth— /internal/control/admin_auth_test.goTestClusterAPI_EveryRPCIsExercisedByATest(walks the generated service descriptor),TestClusterAPI_RefusalsAreNotTransportErrors,TestClusterAPI_ArgumentValidationHappensBeforeConsensus,TestClusterAPI_FenceRequiresAnExplicitIncarnation,TestClusterAPI_StatusIsAnsweredWithoutAQuorum,TestClusterAPI_ALeaderThatLostItsQuorumRefusesHeartbeats,TestClusterAPI_HeartbeatChecksTheIncarnationAndFeedsTheDetector,TestClusterAPI_ClusterConfigOverTheWire,TestClusterAPI_RefusesToServeOnARoutableAddress,TestClusterAPI_JoinControlPlaneAdmitsANonVoterAndNeverMovesOne,TestClusterAPI_ADecommissionedNodeIsToldOnlyOnceItHasLeftTheGroup,TestClusterAPI_AFollowerRedirectsADecommissionedNodeRatherThanAnsweringFinally,TestClusterAPI_ADecommissionedNodeIsNeverAdmittedAgain,TestExplainRegistrationRefusal_PassesThroughEveryOtherRefusal— /internal/control/cluster_service_test.goTestListPartitionHealth_ReportsWhatAFailedNodeLeaves— /internal/control/health_test.goTestClusterAPI_RevokeKeyRecordsTheKeyAndListsIt— /internal/control/revocation_test.go;TestServerBinary_AKeyRevokedThroughTheControlPlaneIsRefusedOnEveryNode— /tests/server_binary_revocation_test.goTestStreamService_ListStreamsCursorSurvivesConcurrentRegistration— /internal/control/service_test.goTestFetchArtifact_AnswersOnlyThePrimaryAndItsCopiesAtTheCurrentEpoch— /internal/replication/fetch_server_test.go
Further reading
- The control plane
- Authentication and tokens, Permissions, mirexa-cli token
- TLS and certificates, mirexa-cli certs
- Configuration reference
- Joining, draining and decommissioning nodes, Moving partitions and rebalancing, Failure detection, leases and failover
- Replication, Reconciliation, scrubbing and repair
- mirexa-cli, Wire protocol, Metrics
External
- gRPC status codes — https://grpc.github.io/grpc/core/md_doc_statuscodes.html
- gRPC richer error model (status details) — https://grpc.io/docs/guides/error/
- gRPC server reflection and
grpcurl— https://github.com/fullstorydev/grpcurl - RFC 6750, "The OAuth 2.0 Authorization Framework: Bearer Token Usage" (the
Authorization: Bearerconvention) — https://www.rfc-editor.org/rfc/rfc6750 - Diego Ongaro and John Ousterhout, "In Search of an Understandable Consensus Algorithm (Extended Version)" — https://raft.github.io/raft.pdf
Header comment of /proto/mirexa/control/v1/control.proto. ↩︎
config.ControlConfigand theControl:block ofconfig.Defaultin /internal/config/config.go;startControlPlanein /cmd/server/main.go. ↩︎loggingInterceptor,metricsInterceptorin /internal/control/server.go;TestControlServer_RecordsRPCMetrics,TestControlServer_LogsEveryRPC. ↩︎NewServerregistersClusterServiceonly whenServerConfig.Clusteris non-nil, whichstartControlPlanesets only with a Raft node;TestControlServer_ServiceSurfaceIsPinned. ↩︎requireLoopbackin /internal/control/server.go;TestControlServer_ARoutableAddressRequiresAdminAuth,TestControlServer_ARoutableAddressRequiresAdminAuthWithoutACluster,TestClusterAPI_RefusesToServeOnARoutableAddress. ↩︎adminAuthInterceptorin /internal/control/admin_auth.go;TestControlServer_AdminAuthGuardsEveryMethod. ↩︎AdminAuth.VerifyandbearerFrom, overnetwork.Server.Admission;TestAdminAuth_UnauthenticatedAndDeniedAreDifferentCodes,TestAdminAuth_ExpiryIsCheckedAfterTheSignature,TestAdminAuth_TwoCredentialsAreRefusedRatherThanPicked,TestAdminAuth_RefusesAKeyTheClusterRevoked,TestAdminAuth_RefusesATokenBeyondTheValidityWindow,TestAdminAuth_TheGrantCeilingApplies. ↩︎ ↩︎StreamServicecomment in the proto;control.Servicein /internal/control/service.go. ↩︎streamIDFromProtoin /internal/control/service.go. ↩︎catalogError,AcceptGapand the argument checks in /internal/control/service.go. ↩︎ClusterService.notLeaderErrorin /internal/control/cluster_service.go;TestClusterAPI_AFollowerRedirectsADecommissionedNodeRatherThanAnsweringFinallyasserts theNotLeaderdetail from a follower. ↩︎ClusterService.lookup;TestClusterAPI_StatusIsAnsweredWithoutAQuorumfor the local exception. ↩︎ClusterService.proposein /internal/control/cluster_service.go;TestClusterAPI_RefusalsAreNotTransportErrors,TestClusterAPI_ArgumentValidationHappensBeforeConsensus. ↩︎explainRegistrationRefusal,decommissionedAnswer;TestClusterAPI_ADecommissionedNodeIsToldOnlyOnceItHasLeftTheGroup,TestClusterAPI_ADecommissionedNodeIsNeverAdmittedAgain. ↩︎ClusterConfig.ReplicationAddrand its validation in /internal/config/config.go. ↩︎