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

CREATE IF NOT EXISTS failed for background DDL #20679

Open
xxchan opened this issue Feb 28, 2025 · 1 comment
Open

CREATE IF NOT EXISTS failed for background DDL #20679

xxchan opened this issue Feb 28, 2025 · 1 comment
Labels
type/bug Something isn't working user-feedback
Milestone

Comments

@xxchan
Copy link
Member

xxchan commented Feb 28, 2025

Describe the bug

User feedback: https://web.clearfeed.app/collections/4875?request=332

dev=> show jobs;
┌────┬──────────────────────────────────────────────────────────────────────────────────┬──────────────┐
│ Id │                                    Statement                                     │   Progress   │
├────┼──────────────────────────────────────────────────────────────────────────────────┼──────────────┤
│ 17 │ CREATE MATERIALIZED VIEW IF NOT EXISTS mv1 AS SELECT range(1, x * 100000) FROM t │ 0.00% (0/99) │
└────┴──────────────────────────────────────────────────────────────────────────────────┴──────────────┘
(1 row)

Time: 18.766 ms
dev=> select * from mv1;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Catalog error
  2: table or source not found: mv1

Time: 3.064 ms
dev=> create materialized view if not exists mv1 as select range(1,x*100000) from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Catalog error
  2: gRPC request to meta service (call `/ddl_service.DdlService/CreateMaterializedView`) failed: Some entity that we attempted to create already exists
  3: table with name mv1 exists

Time: 36.995 ms
dev=> 
dev=> create materialized view if not exists mv1 as select range(1,x*100000) from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Catalog error
  2: gRPC request to meta service (call `/ddl_service.DdlService/CreateMaterializedView`) failed: Some entity that we attempted to create already exists
  3: table with name mv1 exists

Time: 53.492 ms
dev=> create materialized view mv1 as select range(1,x*100000) from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Catalog error
  2: gRPC request to meta service (call `/ddl_service.DdlService/CreateMaterializedView`) failed: Some entity that we attempted to create already exists
  3: table with name mv1 exists

Suspicious code:
I just noticed in the code that for BACKGROUND_DDL, we don’t wait_version for the DDL here, so I’m thinking it may be possible that the frontend table catalog isn’t aware of the already existing table, so send the DDL request to meta, which was rejected by meta later.

if matches!(create_type, PbCreateType::Foreground) {
self.wait_version(version).await?
}

Error message/log


To Reproduce

No response

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

@xxchan xxchan added the type/bug Something isn't working label Feb 28, 2025
@github-actions github-actions bot added this to the release-2.3 milestone Feb 28, 2025
@xxchan
Copy link
Member Author

xxchan commented Feb 28, 2025

@yezizp2012 can you help with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working user-feedback
Projects
None yet
Development

No branches or pull requests

1 participant