Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: crdb_internal_mvcc_timestamp for materialized views should update when view is refreshed #62932

Closed
rafiss opened this issue Apr 1, 2021 · 4 comments
Labels
A-sql-semantics C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@rafiss
Copy link
Collaborator

rafiss commented Apr 1, 2021

Run the following:

> create table t (a int primary key);
> insert into t values (1);
> create materialized view vw as select a, now() from t;

> select a, now, crdb_internal.approximate_timestamp(crdb_internal_mvcc_timestamp) from vw;
  a |                 now                 | crdb_internal.approximate_timestamp
----+-------------------------------------+--------------------------------------
  1 | 2021-04-01 04:23:04.899462+00:00:00 | 2021-04-01 04:23:04.899462

-- wait

> refresh materialized view vw;

> select a, now, crdb_internal.approximate_timestamp(crdb_internal_mvcc_timestamp) from vw;
  a |                 now                 | crdb_internal.approximate_timestamp
----+-------------------------------------+--------------------------------------
  1 | 2021-04-01 04:26:06.552062+00:00:00 | 2021-04-01 04:23:04.899462

The mvcc timestamp should update, since the row was rewritten.

Epic: CRDB-13625
Jira issue: CRDB-6212

@rafiss rafiss added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-semantics labels Apr 1, 2021
@rafiss rafiss added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label May 12, 2021
@ajwerner
Copy link
Contributor

ajwerner commented Mar 8, 2022

This will likely be fixed by the MVCC-compliant AddSSTable.

@rafiss
Copy link
Collaborator Author

rafiss commented Mar 15, 2022

@ajwerner is there an issue/PR we can link to?

@ajwerner
Copy link
Contributor

#70429

@rafiss
Copy link
Collaborator Author

rafiss commented Mar 27, 2022

#78563 probably fixed this

@rafiss rafiss closed this as completed Mar 27, 2022
craig bot pushed a commit that referenced this issue Mar 30, 2022
77864: roachtest: add pebble ycsb/A race build roachtest r=bananabrick a=bananabrick

Release note: None

78586: sql: regression test for MVCC timestamp in materialized views r=dt a=rafiss

refs #62932

Before abeaf01 this test would have
failed, so this test will help make sure we don't regress.

Release note: None

79048: sql: Node user always passes CheckAnyPrivilege r=rafiss a=RichardJCai

No release note since this only affects what is shown
in InternalExecutor queries.

Release note: None

79055: sql: use qualifiable schema name for comment on schema r=chengxiong-ruan a=chengxiong-ruan

Previously we only use current db to resolve a schema when comment
on a schema. This is painful at least for our testing sometimes
because we need to switch db before commenting on a schema.

Release justification: low impact but can be useful for users.
Release note (sql change): `COMMENT ON SCHEMA` now can use qualified
schema name. So can do both `COMMENT ON SCHEMA sc_name ...` and
`COMMENT ON SCHEMA db_name.sc_name ...`.

79068: dev: copy built binaries rather than symlinking them r=mari-crl a=rickystewart

This uses more disk space but is resilient to the confusing case
where your Bazel `output_base` gets deleted (either due to
`bazel clean --expunge` or if your `output_base` gets wiped due to a
macOS upgrade).

Release note: None

Co-authored-by: Arjun Nair <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
Co-authored-by: richardjcai <[email protected]>
Co-authored-by: Chengxiong Ruan <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-semantics C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

2 participants