Skip to content

feat(jobsdb): multi-consumer-specific datasets, indexes, views and flip - #7083

Closed
atzoum wants to merge 4 commits into
feat.mcJobsDB2from
feat.mcJobsDBDDL2
Closed

atzoum wants to merge 4 commits into
feat.mcJobsDB2from
feat.mcJobsDBDDL2

Conversation

@atzoum

@atzoum atzoum commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the foundational schema and infrastructure for multi-consumer support in jobsdb. Today each jobsdb handle has a single implicit consumer: a job's latest status determines its state. This is a first step towards allowing jobs to be consumed independently by multiple consumers, each with its own status timeline per job.

The feature is opt-in per handle via WithMultiConsumer(). Single-consumer handles are completely unaffected — no schema changes, no query overhead.

An existing single-consumer jobsdb can be converted to multi-consumer at runtime. On first startup with WithMultiConsumer(), jobsdb upgrades any existing datasets to the multi-consumer schema. The upgrade is idempotent and crash-safe.

Linear Ticket

resolves PIPE-3058

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

This is part 4 of 5 in a stack made with GitButler:

@codecov

codecov Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.61048% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.57%. Comparing base (eafa943) to head (d67c93b).

Files with missing lines Patch % Lines
jobsdb/jobsdb_dataset_ddl.go 20.83% 11 Missing and 8 partials ⚠️
jobsdb/jobsdb_get.go 88.88% 7 Missing and 6 partials ⚠️
jobsdb/jobsdb_multiconsumer.go 81.81% 6 Missing and 6 partials ⚠️
...artitionmigration/client/migration_job_executor.go 91.66% 1 Missing and 1 partial ⚠️
jobsdb/jobsdb_compaction.go 98.71% 1 Missing and 1 partial ⚠️
jobsdb/jobsdb_store.go 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           feat.mcJobsDBDDL    #7083      +/-   ##
====================================================
- Coverage             79.80%   79.57%   -0.24%     
====================================================
  Files                   583      584       +1     
  Lines                 65229    65552     +323     
====================================================
+ Hits                  52058    52160     +102     
- Misses                10075    10300     +225     
+ Partials               3096     3092       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atzoum atzoum changed the title feat(josbdb): multiconsumer datasets and flip feat(jobsdb): multiconsumer datasets and flip Jun 12, 2026
atzoum added a commit that referenced this pull request Jun 12, 2026
## Description

Without a minimum age guard, newly created datasets, whether written by
normal ingestion or created as a compaction destination, can be picked
up for compaction almost immediately, before workers have had a chance
to process all their jobs. This causes premature I/O churn: jobs get
moved again with little benefit.

This PR introduces `compactionMinDSAge` (default: `2m`):
partially-processed datasets are skipped for compaction until they reach
this minimum age, giving workers a processing window before a dataset
becomes eligible. The age is read from a creation timestamp stored as a
PostgreSQL table comment on each jobs table.

**Fully-processed datasets** and datasets without a recorded creation
time **are unaffected**.

**Config:** `JobsDB.compactionMinDSAge` (reloadable)

## Linear Ticket

resolves PIPE-3114

## Security

- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.

<!-- GitButler Footer Boundary Top -->
---
This is **part 1 of 3 in a stack** made with GitButler:
- <kbd>&nbsp;3&nbsp;</kbd> #7083 
- <kbd>&nbsp;2&nbsp;</kbd> #7082 
- <kbd>&nbsp;1&nbsp;</kbd> #7077 👈 
<!-- GitButler Footer Boundary Bottom -->
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL branch from a54abf0 to f0c14c3 Compare June 12, 2026 13:59
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL2 branch from 91463e1 to fccf41a Compare June 12, 2026 13:59
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL branch from f0c14c3 to 0502233 Compare June 15, 2026 06:57
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL2 branch 7 times, most recently from 40a8635 to 7af1c1e Compare June 15, 2026 15:27
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL branch from 0502233 to 231ef95 Compare June 15, 2026 15:28
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL2 branch from 7af1c1e to 0801434 Compare June 15, 2026 15:28
@atzoum atzoum mentioned this pull request Jun 16, 2026
1 task done
@atzoum atzoum changed the title feat(jobsdb): multiconsumer datasets and flip feat(jobsdb): multi-consumer-specific datasets, indexes, views and flip Jun 16, 2026
@atzoum
atzoum force-pushed the feat.mcJobsDBDDL branch from eafa943 to 9189036 Compare June 17, 2026 06:49
@atzoum
atzoum changed the base branch from feat.mcJobsDBDDL to master June 17, 2026 07:38
@atzoum
atzoum changed the base branch from master to feat.mcJobsDBDDL June 17, 2026 07:38
@atzoum
atzoum changed the base branch from feat.mcJobsDBDDL to feat.mcJobsDB2 June 17, 2026 07:39
@atzoum atzoum closed this Jun 17, 2026
atzoum added a commit that referenced this pull request Jun 22, 2026
## Summary

Adds two new columns to all jobsdb tables (jobs and job_status) as the
foundational schema step for multi-consumer jobsdb support:
- `consumers` on jobs tables — tracks which consumers a job is intended
for
- `consumer` on job_status tables — identifies which consumer a status
row belongs to

Both columns are added universally to all handles (single- and
multi-consumer alike), with safe defaults that preserve existing
single-consumer semantics. All existing read, write, and compaction
paths are updated to carry the new columns through.

## Linear Ticket

Resolves PIPE-3115

## Security

- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.

<!-- GitButler Footer Boundary Top -->
---
This is **part 1 of 5 in a stack** made with GitButler:
- <kbd>&nbsp;5&nbsp;</kbd> #7096 
- <kbd>&nbsp;4&nbsp;</kbd> #7083 
- <kbd>&nbsp;3&nbsp;</kbd> #7094 
- <kbd>&nbsp;2&nbsp;</kbd> #7093 
- <kbd>&nbsp;1&nbsp;</kbd> #7082 👈 
<!-- GitButler Footer Boundary Bottom -->
@atzoum
atzoum deleted the feat.mcJobsDBDDL2 branch June 29, 2026 09:23
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