Skip to content

sqllogictest,testdrive: downgrade to stable release of postgres - #802

Merged
benesch merged 1 commit into
MaterializeInc:masterfrom
benesch:pg-downgrade
Oct 21, 2019
Merged

sqllogictest,testdrive: downgrade to stable release of postgres#802
benesch merged 1 commit into
MaterializeInc:masterfrom
benesch:pg-downgrade

Conversation

@benesch

@benesch benesch commented Oct 21, 2019

Copy link
Copy Markdown
Contributor

Using a stable release of the postgres driver means we can use
off-the-shelf packages for interval and decimal decoding, rather than
rolling our own.

Using a stable release of the postgres driver means we can use
off-the-shelf packages for interval and decimal decoding, rather than
rolling our own.
@benesch
benesch requested a review from quodlibetor October 21, 2019 17:16
// want to get to `significand2 * 10^desired_scale`
// so `significand2 = significand * 10^(current_scale - desired_scale)`
let scale_correction = current_scale - (i64::from(desired_scale));
let scale_correction = (d.scale as isize) - (desired_scale as isize);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did they change the upstream types here so we need to change it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess I mean will they have changed the types when we upgrade.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well we used to be using our own DecimalWrapper thingy (removed from below) which said scales was an i64, whereas now d is a rust_decimal::Decimal which thinks scale is a u32.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ahh okay yeah that makes sense.

@quodlibetor quodlibetor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

other than not being sure why some integer types changed this looks good to me

@benesch benesch left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TFTR!

// want to get to `significand2 * 10^desired_scale`
// so `significand2 = significand * 10^(current_scale - desired_scale)`
let scale_correction = current_scale - (i64::from(desired_scale));
let scale_correction = (d.scale as isize) - (desired_scale as isize);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well we used to be using our own DecimalWrapper thingy (removed from below) which said scales was an i64, whereas now d is a rust_decimal::Decimal which thinks scale is a u32.

@benesch
benesch merged commit cf109f1 into MaterializeInc:master Oct 21, 2019
@benesch
benesch deleted the pg-downgrade branch October 21, 2019 18:15
antiguru added a commit that referenced this pull request Jul 15, 2026
Our `mz_join_core` is a fork of differential's `JoinCore::join_core` and
inherited a correctness bug fixed upstream in
TimelyDataflow/differential-dataflow#802 (issue #801).

The operator skipped incoming batches by testing `batch.lower()` against
the mutable `acknowledged` frontier. `advance_upper` can advance
`acknowledged` past an in-flight batch when trace merges consolidate the
batch's updates away, e.g. an add/remove pair collapsing once logical
compaction equates their times. The trace is legitimately empty there
only for readers at or beyond the compaction frontier, while our
consumers may read finer times where the batch's updates are still real.
Testing against `acknowledged` therefore dropped such batches and
silently lost updates.

The fix captures fixed `preload_upper` frontiers at start-up and gates
the skip on them, and advances `acknowledged` only when a batch sits at
or beyond it. This is a one-to-one port of the upstream change.

No regression test: deterministically reproducing the race requires
trace merges to consolidate an add/remove pair while a batch is in
flight and `advance_upper` to then jump ahead, which is timing-dependent
and not reliable in testdrive/sqllogictest. Upstream #802 added no
direct join test either. Correctness rests on mirroring the upstream
reasoning.

Note: the alternate `DifferentialDataflow` join implementation calls
upstream `join_core` from crates.io `differential-dataflow` 0.24.0,
which still carries the bug and will be fixed by a future dependency
bump.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants