Skip to content

Redesign query-job timestamps to use MariaDB server time #2516

Description

@coderabbitai

Summary

Redesign query-job timestamp handling so MariaDB is the single source of truth for query start and termination times.

Required changes

  • Set the query-job start time when the query starts, using the MariaDB server time.
  • Set an end time when the query reaches a terminal state.
  • Ensure every terminated query has an end time, including failed, killed, and cancelled queries.
  • Derive duration from end_time - start_time when duration is required.
  • Update affected query scheduler and orchestration database schema code.

Rationale

The current scheduler sets start_time and calculates duration from scheduler-host time. A terminated job can also have no duration when no start time was set. Database-generated timestamps avoid host-clock differences and provide a reliable termination time for result-retention cleanup.

Affected areas

  • Query scheduler timestamp updates.
  • Orchestration database query-jobs schema and migrations.
  • Consumers of start_time and duration, including search-result garbage collection.

Acceptance criteria

  • MariaDB generates query start and end timestamps.
  • Every terminal query state records an end time.
  • Duration, where needed, is derived from the stored start and end times.
  • Result-retention logic can determine expiry for all terminal query jobs.

Backlinks

Requested by @LinZhihao-723.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions