sql: change materialized view not to be created with fixed timestamp.#80651
Conversation
ajwerner
left a comment
There was a problem hiding this comment.
once you add a release note (make sure to add it to the PR description too)
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @Xiang-Gu)
-- commits line 18 at r1:
This deserves a release note and then backports
Previously, a materialized view was created with fixed time timestamp ( namely, its `CreateAsOfTime` is initialized to transaction's read time). If the transaction that created this materialized view is pushed forward then `CreateAsOfTime` will be before other descriptors created in the same transaction, causing the backfill job for create materialized view to fail because the other, needed descriptors are not visible at that early `CreatedAsOfTime`. We address this by removing the line that sets `CreateAsOfTime` field of the materalized view, and it instead will reply on the MVCC protocol to populate this field based on the MVCC timestamp of the row containing the needed descriptors when backfilling this materialized view. Release note (bug fix): This PR fixes a bug where if a transaction's commit time is pushed forward from its initial provisional time, a enclosing `CREATE MATERIALIZED VIEW AS ...` might fail to find other descriptors created in the same transaction during the view's backfill stage. The detailed descriptor of this bug is summarized in issue cockroachdb#79015
034d8c0 to
044dea4
Compare
|
bors r+ |
|
Build failed: |
ajwerner
left a comment
There was a problem hiding this comment.
Unrelated flake
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Xiang-Gu)
|
Build succeeded: |
|
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 044dea4 to blathers/backport-release-21.2-80651: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 21.2.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
|
@Xiang-Gu please backport this manually to 21.2 |
Previously, a materialized view was created with fixed time timestamp (
namely, its
CreateAsOfTimeis initialized to transaction's read time).If the transaction that created this materialized
view is pushed forward then
CreateAsOfTimewill be before otherdescriptors created in the same transaction, causing the backfill job
for create materialized view to fail because the other, needed
descriptors are not visible at that early
CreatedAsOfTime.We address this by removing the line that sets
CreateAsOfTimefieldof the materalized view, and it instead will reply on the MVCC protocol
to populate this field based on the MVCC timestamp of the row containing
the needed descriptors when backfilling this materialized view.
fixes: #79015
Release note (bug fix): This PR fixes a bug where if a transaction's
commit time is pushed forward from its initial provisional time, a
enclosing
CREATE MATERIALIZED VIEW AS ...might fail to find otherdescriptors created in the same transaction during the view's backfill
stage. The detailed description of this bug is summarized in issue #79015.