Skip to content

IDC: Outbox implemenation#4780

Open
Shubham8287 wants to merge 6 commits intomasterfrom
shub/idc
Open

IDC: Outbox implemenation#4780
Shubham8287 wants to merge 6 commits intomasterfrom
shub/idc

Conversation

@Shubham8287
Copy link
Copy Markdown
Contributor

@Shubham8287 Shubham8287 commented Apr 13, 2026

Implements outbox part of IDC proposal.

PR can be best reviewed commit-wise.

end to end smoketest is defined in #4781 along with hacky macro changes.

Description of changes:

System Tables

ST_OUTBOUND_MSG

  • Maintains an auto-incrementing msg_id per sender.
  • Stores in-flight outbound reducer calls (outbox pattern).
  • Used by IdcActor to issue remote calls with strictly increasing msg_id.

ST_INBOUND_MSG

  • Tracks latest processed msg_id per sender along with reducer result
  • For duplicate requests where the msg_id is already present, the result is returned without executing the reducer.
  • Requests with a msg_id older than the latest seen for a sender are dropped

Actor

IDCActor handles execution.

  • Drives reducer execution from ST_OUTBOUND_MSG
  • Calls on_result reducer and delete entry from ST_OUTBOUND_MSG in same transaction.
  • If reducer fails, delete entry in next transaction, somewhat similar to SchedulerActror
  • Reducer failure are only considered if reducer actually ran and returned error, all other cases of error will result in retrying.

API

call_from_database(database_identity, msg_id, params)

  • Caller should ensure msg_id never decrease for same sender database_identity else API returns InvalidRequest.
  • If reducer ran and failed it returns StatusCode::UNPROCESSABLE_ENTITY, which caller shouln't retry.
  • All other errors, including network errors are retried by IdcActor.

TODO:

  • handle outbox row deletion.

API and ABI breaking changes

N/A, additive changes only

Expected complexity level and risk

3.5, satisfying exactly-one semantic could be tricky and should be thoroughly reviewed.

Testing

  • New smoketest for call_from_database api.
  • end to end smoketest with macro is implemented in different PR.

 1. ST_OUTBOUND_MSG
	1. Maintains an auto-incrementing msg_id per sender.
	2. Stores in-flight outbound reducer calls (outbox pattern).
	3. Used by IdcActor to issue remote calls with strictly increasing msg_id.
2. ST_INBOUND_MSG
	1. Tracks latest processed msg_id per sender along with reducer result
	2. For duplicate requests where the msg_id is already present, the result is returned without executing the reducer.
	3. Requests with a msg_id older than the latest seen for a sender are dropped
- update `schema` crate for validation logic
- update `TableSchema` with `outbox: Option<OutboxDef>` field
- Drives reducer execution from `ST_OUTBOUND_MSG`
- Calls `on_result` reducer and delete entry from  `ST_OUTBOUND_MSG` in same transaction.
- If reducer fails, delete entry in next transaction, somewhat similar to `SchedulerActror`
- Reducer failure are only considered if reducer actually ran and returned error, all other cases of error will result in retrying.

`call_from_database(database_identity, msg_id, params)`

- Caller should ensure `msg_id` never decrease for same sender `database_identity` else API returns `InvalidRequest`.
- If reducer ran and failed it returns `StatusCode::UNPROCESSABLE_ENTITY`, which caller shouln't retry.
- All other errors, including network errors are retried by `IdcActor`.
This was referenced Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant