Mirexa

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.enabled false Turns the listener on. Off by default: a node does not start exposing an administrative surface because it was upgraded.
control.addr 127.0.0.1:9091 Listen address. Loopback by default.
control.reflection 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.use_tls false Serves the listener with the data plane's TLS configuration (one certificate, one reload path). Requires security.tls_enabled; there are no separate certificate settings.
control.admin_auth false Requires an ADMIN_CLUSTER token on every call — see Authentication.
control.shutdown_timeout 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.control.v1.StreamService always (when the listener is on)
mirexa.control.v1.NodeStatusService always
mirexa.control.v1.ClusterService only when cluster.enabled is true
grpc.reflection.* only when control.reflection 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.addr host Without admin_auth
a loopback IP literal (127.0.0.1, ::1) allowed
localhost allowed (the one hostname accepted)
empty (:9090, 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 token and carrying the ADMIN_CLUSTER permission bit (bit 6). See Permissions.
  • Where it goes: gRPC metadata key authorization, value Bearer <token>. The scheme is matched case-insensitively. Exactly one value: two authorization entries are refused rather than one picked.
  • Verified against security.auth.trusted_keys, the same keys the data plane uses. Turning admin_auth on with no trusted keys is a startup failure (control.ErrNoAdminKeys), not a server that refuses every call.
bash
mirexa-cli token issue -key admin.key -perms ADMIN_CLUSTER -validity 30m > admin.token
bash
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.MaxTokenValidity), no undefined permission bits revoked / expired / too long-lived / undefined bit UNAUTHENTICATED admin credential is refused: <reason>
the grant (the token's bits ∩ security.max_permissions) holds ADMIN_CLUSTER valid token, wrong permissions PERMISSION_DENIED admin credential lacks ADMIN_CLUSTER (carries …)
carries the bit, but max_permissions does not grant it PERMISSION_DENIED admin credential carries ADMIN_CLUSTER, but this node's security.max_permissions does not grant it

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_threshold_low_nanos int64 shortest gap recorded at all
gap_threshold_high_nanos int64 on a stream without working hours, a gap at least this long is filed as a closure (OFF_TIME)
custom_fields map<string,string> stored, no effect on behaviour
has_working_hours bool output only
working_hours WorkingHours weekly schedule; absent = 24/7
closures repeated Closure declared closures, stored sorted and merged
lineage Lineage output only; written by SetStreamLineage alone
cache_capacity 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_grace_nanos int64 how late source data still joins a bar; 0 = 1s
no_trade_limit_nanos int64 tick sources only; longest silence that is not missing data; 0 = 10s
since_nanos int64 output only: when the derived stream begins
rederive_pending 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_id, 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_id stream NOT_FOUND if not in this node's catalog.
ListStreams page_size, page_token, exchange, symbol_prefix, timeframe streams, next_page_token Key-set paging in (exchange, symbol, timeframe) order. page_size 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_ARGUMENT. Empty next_page_token = last page.
UpdateStreamMetadata stream_id, metadata stream, refiled_nanos Replaces the metadata of a known stream (does not create). Already-filed gaps are re-filed under the new calendar before it returns; refiled_nanos is how much gap changed classification. A gap since filled with data is never touched.
DeleteStream stream_id removed_from_catalog 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_id, closure stream, refiled_nanos Declares a closure (holiday, halt, or an outage the operator accepts as a closure) and re-files.
RemoveStreamClosure stream_id, start_nanos, end_nanos stream, refiled_nanos Removes a range from the declared closures, cutting any closure it overlaps, and re-files.
SetStreamLineage stream_id, 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_id, cache_capacity 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_id, gap_start_nanos, accept gap Marks a derived bar's INCOMPLETE mark ACCEPTED (accept: true) or puts it back to OPEN. The start must match a mark exactly as listed.

Refusal codes:[10]

Code When
INVALID_ARGUMENT missing or malformed stream_id; 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_FOUND stream not in this node's catalog; AcceptGap naming a start no gap has
FAILED_PRECONDITION 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_seconds, ready (the same health manager as /ready), stream_count (this node's catalog), partition_count (the layout's), data_dir Cheap.
GetStorageStats total_bytes (every file under storage.data_dir, WAL and Raft log included), stream_count 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_node_id uint64 current leader, 0 when none is known
leader_raft_addr string the leader's Raft address — not a control endpoint; not filled by the current code
leader_control_addr 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.

notLeaderError sets only leader_node_id and leader_control_addr; leader_raft_addr is declared in the proto but left empty (read from ClusterService.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_PRECONDITION, message <op> was refused by the control-plane state; read it back to see why 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_PRECONDITION + 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_PRECONDITION, 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_ARGUMENT 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_id uint64
raft_addr string consensus transport address
data_addr 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_addr string this node's control listener
replication_addr string the inter-node replication listener; empty if it serves none

PartitionAssignment

Field Type Meaning
partition_id uint32
primary uint64 the one node that accepts writes
secondary_node_ids repeated uint64 copies
in_sync_node_ids 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_node_ids 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_REPLICA (1) target holds nothing yet; next it is added as a secondary
CATCHING_UP (2) target is seeding; the next move is the target's own
READY_TO_CUT (3) target is in sync and may run the cutover
DRAINING_SOURCE (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_id node Unset node when not registered — absence is an answer, not NOT_FOUND.
JoinControlPlane node_id, raft_addr admitted_index 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_index. Same id at the same address: admitted again, nothing written. Same id at a different address: ALREADY_EXISTS. A timeout is plain UNAVAILABLE (admission is idempotent, so a retry is safe).
RegisterNode node_id, raft_addr, data_addr, control_addr (all required), replication_addr 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_id 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_id, 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_id 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_id (0 = all) partitions Non-zero node_id: only partitions it holds as primary or secondary.
GetPartition partition_id assignment Unset when the partition has no entry.
AssignPartition partition_id, primary (required), secondary_node_ids 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_id, in_sync_node_ids (non-empty) assignment Replaces the whole in-sync set. Does not move the epoch. Operator use; nodes use the next two.
JoinInSync partition_id, node_id 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_id, node_id assignment Removes one node; the primary cannot leave.
ReadmitDivergent partition_id, node_id 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_id, target_node_id (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_PRECONDITION.
AbortMigration partition_id, target_node_id (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_id, status, primaries, copies, in_migration) A node leaves the list once all three counts reach zero and it is decommissioned.
ListPartitionHealth impaired_only partitions (PartitionHealth) Projected from the directory and registry. impaired_only returns only partitions not SERVING.
GetRebalancePlan — moves, evaluated_at_unix_nanos What the balancer would move, without moving it. Read from the leader's last evaluation, run every cluster.rebalance_interval. FAILED_PRECONDITION 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_REPLICATED (2) primary serving; a copy is on a fenced node or divergent
PRIMARY_DOWN (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_id, incarnation, load (NodeLoadReport, optional), raft_commit_index accepted, liveness_timeout_nanos, state_position Sent by each node to the leader. Not a Raft proposal. accepted: false (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_timeout_nanos from its send time, once its own state reaches state_position. A leader that has lost its quorum refuses heartbeats.
GetClusterStatus — local_node_id, leader_node_id, is_leader, term, voters, non_voters, commit_index, applied_index, last_index, registered_nodes, assigned_partitions Answered locally from this replica. There is no per-follower match index; lag is a subtraction across two nodes' commit_index.

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_count, compression, expected_version, liveness_timeout_nanos, replication_factor — all required (expected_version 0 seeds a fresh cluster) settings Compare-and-set: a stale expected_version is refused. partition_count, liveness_timeout_nanos and replication_factor 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_key (the 32 raw Ed25519 bytes) key (RevokedKey: public_key, revoked_at) Revokes a token issuer cluster-wide. Permanent and idempotent: revoked_at 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_ARGUMENT.
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 requires cluster.replication_cert_file, replication_key_file and replication_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 NotPrimary detail.
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

Tests

  • TestControlServer_ServiceSurfaceIsPinned, TestControlServer_ReflectionOnlyWhenEnabled, TestControlServer_TLSHandshake, TestControlServer_RecordsRPCMetrics, TestControlServer_LogsEveryRPC — /internal/control/server_test.go
  • TestAdminAuth_UnauthenticatedAndDeniedAreDifferentCodes, TestAdminAuth_ExpiryIsCheckedAfterTheSignature, TestAdminAuth_TwoCredentialsAreRefusedRatherThanPicked, TestAdminAuth_RefusesToBuildWithNoKeys, TestAdminCredential_PresentsTheTokenTheServerExpects, TestControlServer_AdminAuthGuardsEveryMethod, TestControlServer_ARoutableAddressRequiresAdminAuth — /internal/control/admin_auth_test.go
  • TestClusterAPI_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.go
  • TestListPartitionHealth_ReportsWhatAFailedNodeLeaves — /internal/control/health_test.go
  • TestClusterAPI_RevokeKeyRecordsTheKeyAndListsIt — /internal/control/revocation_test.go; TestServerBinary_AKeyRevokedThroughTheControlPlaneIsRefusedOnEveryNode — /tests/server_binary_revocation_test.go
  • TestStreamService_ListStreamsCursorSurvivesConcurrentRegistration — /internal/control/service_test.go
  • TestFetchArtifact_AnswersOnlyThePrimaryAndItsCopiesAtTheCurrentEpoch — /internal/replication/fetch_server_test.go

Further reading

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: Bearer convention) — 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

  1. Header comment of /proto/mirexa/control/v1/control.proto. ↩︎

  2. config.ControlConfig and the Control: block of config.Default in /internal/config/config.go; startControlPlane in /cmd/server/main.go. ↩︎

  3. loggingInterceptor, metricsInterceptor in /internal/control/server.go; TestControlServer_RecordsRPCMetrics, TestControlServer_LogsEveryRPC. ↩︎

  4. NewServer registers ClusterService only when ServerConfig.Cluster is non-nil, which startControlPlane sets only with a Raft node; TestControlServer_ServiceSurfaceIsPinned. ↩︎

  5. requireLoopback in /internal/control/server.go; TestControlServer_ARoutableAddressRequiresAdminAuth, TestControlServer_ARoutableAddressRequiresAdminAuthWithoutACluster, TestClusterAPI_RefusesToServeOnARoutableAddress. ↩︎

  6. adminAuthInterceptor in /internal/control/admin_auth.go; TestControlServer_AdminAuthGuardsEveryMethod. ↩︎

  7. AdminAuth.Verify and bearerFrom, over network.Server.Admission; TestAdminAuth_UnauthenticatedAndDeniedAreDifferentCodes, TestAdminAuth_ExpiryIsCheckedAfterTheSignature, TestAdminAuth_TwoCredentialsAreRefusedRatherThanPicked, TestAdminAuth_RefusesAKeyTheClusterRevoked, TestAdminAuth_RefusesATokenBeyondTheValidityWindow, TestAdminAuth_TheGrantCeilingApplies. ↩︎ ↩︎

  8. StreamService comment in the proto; control.Service in /internal/control/service.go. ↩︎

  9. streamIDFromProto in /internal/control/service.go. ↩︎

  10. catalogError, AcceptGap and the argument checks in /internal/control/service.go. ↩︎

  11. ClusterService.notLeaderError in /internal/control/cluster_service.go; TestClusterAPI_AFollowerRedirectsADecommissionedNodeRatherThanAnsweringFinally asserts the NotLeader detail from a follower. ↩︎

  12. ClusterService.lookup; TestClusterAPI_StatusIsAnsweredWithoutAQuorum for the local exception. ↩︎

  13. ClusterService.propose in /internal/control/cluster_service.go; TestClusterAPI_RefusalsAreNotTransportErrors, TestClusterAPI_ArgumentValidationHappensBeforeConsensus. ↩︎

  14. explainRegistrationRefusal, decommissionedAnswer; TestClusterAPI_ADecommissionedNodeIsToldOnlyOnceItHasLeftTheGroup, TestClusterAPI_ADecommissionedNodeIsNeverAdmittedAgain. ↩︎

  15. ClusterConfig.ReplicationAddr and its validation in /internal/config/config.go. ↩︎