partisan_rpc_backend (partisan v6.0.0)

View Source

The counterpart of OTP's rex server: the node-wide process that serves the RPC operations which are *defined* as running on a server.

It is not legacy machinery awaiting deletion. OTP still keeps rex and still routes block_call, sbcast, abcast and eval_everywhere through it, and so does Partisan. What changed in 6.0.0 is its scope: call no longer comes here to be applied inline. partisan_erpc and partisan_rpc:call/4,5 now issue a correlated request that this server dispatches to a worker process, one per request. block_call is the deliberate exception — see the ?RPC_BLOCK_CALL clause.

Wire protocols accepted

This server accepts three request framings. Two are current, one exists only for compatibility:

  • ?ERPC_REQUEST / ?ERPC_CAST — the correlated protocol introduced in 6.0.0. Each request carries its own correlation reference, so a caller with several requests outstanding can tell the replies apart.
  • ?RPC_BLOCK_CALLblock_call, applied in this process by design.
  • {call, M, F, A, Timeout, {origin, Caller}}the pre-6.0.0 framing. No 6.x node ever sends it. It is retained as a *receiver* only, so that during a rolling upgrade an upgraded node still answers RPCs issued by a peer still running 5.x.

Rolling upgrade

Both framings are accepted for the whole of the 6.x series, so nodes may be upgraded one at a time in any order and there is no coordination requirement:

  • a 5.x caller reaching a 6.x node uses the legacy clause and gets the same answer it always did — with the concurrency bound now applied, so an overloaded node answers {badrpc, overloaded} instead of spawning without limit;
  • a 6.x caller reaching a 5.x node cannot use the correlated protocol, because a 5.x server has no clause for it and will silently discard the message. The caller observes a timeout. Upgrade every node in a cluster before relying on partisan_erpc between them. This direction is the reason the legacy clause is kept: it makes the partially-upgraded cluster work for the callers that already exist, rather than making both directions work for callers that do not yet.

The legacy clause — the clause, not this module — is scheduled for removal in 7.0.0. By then every supported caller emits the correlated protocol, so keeping it would only preserve the framing's known defect: it carries no request id, so a reply that arrives after its caller timed out can be consumed by an unrelated later call in the same process.

Summary

Functions

code_change(OldVsn, State, Extra)

handle_call(Msg, From, State)

handle_cast(Msg, State)

handle_info(Msg, State)

init(_)

start_link()

terminate(Reason, State)