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

Fix bug with base relation truncate for IMMV #570

Merged
merged 5 commits into from
Aug 16, 2024

Conversation

reshke
Copy link
Contributor

@reshke reshke commented Aug 13, 2024

On current HEAD, there is bug with base table TRUNCATE for IMMV

reshke=# create table tt(i int);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
reshke=# create incremental materialized view mv1 as select * from tt ;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'i' as the Cloudberry Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
SELECT 0
reshke=# truncate tt;
WARNING:  relcache reference leak: relation "tt" not closed  (seg0 127.0.1.1:7002 pid=17791)
WARNING:  TupleDesc reference leak: TupleDesc 0x7fcdea6d9570 (40987,-1) still referenced  (seg0 127.0.1.1:7002 pid=17791)
WARNING:  relcache reference leak: relation "tt" not closed  (seg1 127.0.1.1:7003 pid=17792)
WARNING:  TupleDesc reference leak: TupleDesc 0x7f8af3e2c570 (40987,-1) still referenced  (seg1 127.0.1.1:7003 pid=17792)
WARNING:  relcache reference leak: relation "tt" not closed  (seg2 127.0.1.1:7004 pid=17793)
WARNING:  TupleDesc reference leak: TupleDesc 0x7f4424548570 (40987,-1) still referenced  (seg2 127.0.1.1:7004 pid=17793)
WARNING:  relcache reference leak: relation "tt" not closed
WARNING:  TupleDesc reference leak: TupleDesc 0x7f8855f23558 (40987,-1) still referenced
TRUNCATE TABLE

Provided patch fixes it.

Fix borrowed from https://www.postgresql.org/message-id/20240711132357.fe3f78c184cfa99159208178%40sranhm.sraoss.co.jp

@my-ship-it my-ship-it requested a review from yjhjstz August 13, 2024 06:42
@reshke
Copy link
Contributor Author

reshke commented Aug 13, 2024

This bug does not reproduce in tests, because in tests we use begin/rollback or begin/commit. It this case it works fine

reshke=# begin;
BEGIN
reshke=*# create incremental materialized view mv1 as select * from tt ;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'i' as the Cloudberry Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
SELECT 0
reshke=*# truncate tt;
TRUNCATE TABLE
reshke=*# rollback ;
ROLLBACK
reshke=# create incremental materialized view mv1 as select * from tt ;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'i' as the Cloudberry Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
SELECT 0
reshke=# begin;
BEGIN
reshke=*# truncate tt;
TRUNCATE TABLE
reshke=*# rollback ;
ROLLBACK
reshke=#

Should I add my test case to incremental_view.sql tests?

@yjhjstz
Copy link
Member

yjhjstz commented Aug 13, 2024

add my test case to incremental_view.sql tests

that's good idea.

@my-ship-it my-ship-it merged commit c98d6c4 into apache:main Aug 16, 2024
11 checks passed
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.

3 participants