This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 3a765079d [KYUUBI #6066] Fix PostgreSQL metastore migration script
failure if indexes already exist
3a765079d is described below
commit 3a765079db598c61fa892fca334609ff01ecc240
Author: Tigran Manasyan <[email protected]>
AuthorDate: Tue Feb 20 23:05:30 2024 +0800
[KYUUBI #6066] Fix PostgreSQL metastore migration script failure if indexes
already exist
# :mag: Description
## Issue References ๐
This pull request is a small fix for #5674
## Describe Your Solution ๐ง
PostgreSQL support as backend for metadata store was added in #6027. If we
choose it and run schema init scripts several times, then the following errors
will be logged: `Error executing sql: CREATE UNIQUE INDEX
unique_identifier_index ON metadata(identifier), with params: . ERROR: relation
"unique_identifier_index" already exists`. This PR adds lacking `IF NOT EXISTS`
to db indexes creation ddls in the PostgreSQL metastore init script.
## Types of changes :bookmark:
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Test Plan ๐งช
#### Behavior Without This Pull Request :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
---
# Checklist ๐
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
Closes #6066 from tigrulya-exe/feature/5674-postgresql-metadata-backend.
Closes #6066
bb6487c16 [Tigran Manasyan] Fix PostgreSQL metastore migration script
failure if indexes already exist
Authored-by: Tigran Manasyan <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
---
.../sql/postgresql/metadata-store-schema-1.9.0.postgresql.sql | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/kyuubi-server/src/main/resources/sql/postgresql/metadata-store-schema-1.9.0.postgresql.sql
b/kyuubi-server/src/main/resources/sql/postgresql/metadata-store-schema-1.9.0.postgresql.sql
index 4c7ab0dc9..76d0e65b9 100644
---
a/kyuubi-server/src/main/resources/sql/postgresql/metadata-store-schema-1.9.0.postgresql.sql
+++
b/kyuubi-server/src/main/resources/sql/postgresql/metadata-store-schema-1.9.0.postgresql.sql
@@ -52,8 +52,8 @@ COMMENT ON COLUMN metadata.end_time IS 'the metadata end
time';
COMMENT ON COLUMN metadata.priority IS 'the application priority, high value
means high priority';
COMMENT ON COLUMN metadata.peer_instance_closed IS 'closed by peer kyuubi
instance';
-CREATE UNIQUE INDEX unique_identifier_index ON metadata(identifier);
-CREATE INDEX user_name_index ON metadata(user_name);
-CREATE INDEX engine_type_index ON metadata(engine_type);
-CREATE INDEX create_time_index ON metadata(create_time);
-CREATE INDEX priority_create_time_index ON metadata(priority DESC, create_time
ASC);
\ No newline at end of file
+CREATE UNIQUE INDEX IF NOT EXISTS unique_identifier_index ON
metadata(identifier);
+CREATE INDEX IF NOT EXISTS user_name_index ON metadata(user_name);
+CREATE INDEX IF NOT EXISTS engine_type_index ON metadata(engine_type);
+CREATE INDEX IF NOT EXISTS create_time_index ON metadata(create_time);
+CREATE INDEX IF NOT EXISTS priority_create_time_index ON metadata(priority
DESC, create_time ASC);
\ No newline at end of file