Skip to content

db: migrate outstanding batches table to new times#4397

Merged
tgeoghegan merged 2 commits intomainfrom
timg/datastore-time-precision-outstanding-batches
Feb 26, 2026
Merged

db: migrate outstanding batches table to new times#4397
tgeoghegan merged 2 commits intomainfrom
timg/datastore-time-precision-outstanding-batches

Conversation

@tgeoghegan
Copy link
Contributor

@tgeoghegan tgeoghegan commented Feb 25, 2026

Also some cleanup: we rename SqlIntervalTimePrecision to SqlInterval and delete the existing SqlInterval.

Part of #4206

@tgeoghegan tgeoghegan requested a review from a team as a code owner February 25, 2026 18:34
@tgeoghegan tgeoghegan marked this pull request as draft February 25, 2026 18:46
@tgeoghegan

This comment was marked as outdated.

Base automatically changed from timg/datastore-time-precision-collection-jobs-table to main February 26, 2026 01:11
@tgeoghegan tgeoghegan force-pushed the timg/datastore-time-precision-outstanding-batches branch from 0b0a65b to cee40e6 Compare February 26, 2026 01:12
@tgeoghegan tgeoghegan added the allow-changed-migrations Override the ci-migrations check to allow migrations that have changed. label Feb 26, 2026
@tgeoghegan tgeoghegan marked this pull request as ready for review February 26, 2026 01:13
Also some cleanup: the old `SqlInterval` is removed in favor of the
simpler `SqlIntervalTimePrecision` (which of course we rename).

Part of #4206
@tgeoghegan tgeoghegan force-pushed the timg/datastore-time-precision-outstanding-batches branch from cee40e6 to 2e8fa4c Compare February 26, 2026 01:13
WHERE task_id = $1
AND batch_identifier = $2
GROUP BY batch_identifier
HAVING MAX(UPPER(client_timestamp_interval)) >= $6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client_timestamp_interval is now INT8RANGE, and UPPER returns BIGINT of time precisions, right? Which means here, and further down in the get_unfilled_outstanding_batches methods, we need to use the new &task_info.report_expiry_threshold_as_time_precision_units, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do need to work in time precision units here, and that's what TaskInfo::report_expiry_threshold returns. In the previous PR in this sequence (#4395), I eliminated the last place that used the old version of that function and renamed report_expiry_threshold_as_time_precision_units.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d'oh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to apologize or feel silly: this stuff is subtle and tricky, and it's moved around a ton in the last two weeks. It's better to err on the side of caution here.

@tgeoghegan tgeoghegan requested a review from jcjones February 26, 2026 20:52
@tgeoghegan tgeoghegan enabled auto-merge (squash) February 26, 2026 21:01
Copy link
Contributor

@jcjones jcjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sheepishly hitting approve

@tgeoghegan tgeoghegan merged commit ebcf92c into main Feb 26, 2026
8 checks passed
@tgeoghegan tgeoghegan deleted the timg/datastore-time-precision-outstanding-batches branch February 26, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-changed-migrations Override the ci-migrations check to allow migrations that have changed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants