Skip to content

Docs: Confusing Schedule Table Lifecycle and Transaction Semantics #5252

@ferntheplant

Description

@ferntheplant

The schedule tables documentation does not describe critical lifecycle behaviors that differ between procedures and reducers, leading to
confusing errors and unexpected results.

Undocumented Behaviors

  • Scheduled procedures delete the row before execution, so schedule_table.find(scheduled_id) returns null and .update() fails. Source:
    crates/core/src/host/scheduler.rs:510-520
      // For scheduled procedures, it's incorrect to retry them if execution aborts midway,
      // so we must remove the schedule row before executing.
      let reschedule = delete_scheduled_function_row(...);
      ScheduledProcedureStep::Procedure { params, reschedule }
  • Scheduled reducers delete the row after execution, so the row is visible during reducer execution. Source:
    crates/core/src/host/scheduler.rs:590-593
  • Interval schedules are never deleted—only one-shot schedules are removed. Source: crates/core/src/host/scheduler.rs:638-668
  • The scheduler uses an in-memory queue separate from the database. Deleting a row doesn't immediately remove it from the queue; the queue
    entry fires, finds no row, and silently exits. Source: crates/core/src/host/instance_env.rs:384-386 and
    crates/core/src/host/scheduler.rs:343-364
  • Row data is passed as a parameter (serialized to BSATN), which is how procedures receive the row data even though it's already deleted.
    Source: crates/core/src/host/scheduler.rs:740-747

Request

Please add documentation covering:

  • When schedule rows are deleted (procedures vs reducers vs intervals)
  • The transaction isolation of scheduled function execution
  • The in-memory scheduler queue and its relationship to database state
  • That row data should be accessed via the parameter, not by querying the schedule table

These behaviors are intentional (the source code has helpful comments explaining the rationale), but they're not visible in user-facing documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions