From f3ee5c5efa68e309231f8e1d1b14553bef45e8c7 Mon Sep 17 00:00:00 2001 From: totaj Date: Thu, 24 Aug 2023 17:38:31 +0800 Subject: [PATCH] Fix update/rollback failed with dolphin. --- build/script/aarch64_lite_list | 2 ++ build/script/aarch64_opengauss_list | 2 ++ build/script/x86_64_lite_list | 2 ++ build/script/x86_64_opengauss_list | 2 ++ .../rollback-post_catalog_maindb_92_906.sql | 26 +++++++++++++++++ .../rollback-post_catalog_otherdb_92_906.sql | 24 ++++++++++++++++ .../upgrade-post_catalog_maindb_92_906.sql | 28 ++++++++++++++++++- .../upgrade-post_catalog_otherdb_92_906.sql | 28 ++++++++++++++++++- 8 files changed, 112 insertions(+), 2 deletions(-) diff --git a/build/script/aarch64_lite_list b/build/script/aarch64_lite_list index 3d6e75783..10038ccce 100644 --- a/build/script/aarch64_lite_list +++ b/build/script/aarch64_lite_list @@ -37,8 +37,10 @@ ./share/postgresql/extension/dolphin--1.0.sql ./share/postgresql/extension/dolphin--1.0--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.0.sql +./share/postgresql/extension/dolphin--2.0--2.0.1.sql ./share/postgresql/extension/dolphin--1.1--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.1.sql +./share/postgresql/extension/dolphin--2.0.1--2.0.sql ./share/postgresql/extension/openGauss_expr_dolphin.ir ./share/postgresql/extension/file_fdw--1.0.sql ./share/postgresql/extension/plpgsql.control diff --git a/build/script/aarch64_opengauss_list b/build/script/aarch64_opengauss_list index 305cdd247..2904c867a 100644 --- a/build/script/aarch64_opengauss_list +++ b/build/script/aarch64_opengauss_list @@ -76,8 +76,10 @@ ./share/postgresql/extension/dolphin--1.0.sql ./share/postgresql/extension/dolphin--1.0--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.0.sql +./share/postgresql/extension/dolphin--2.0--2.0.1.sql ./share/postgresql/extension/dolphin--1.1--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.1.sql +./share/postgresql/extension/dolphin--2.0.1--2.0.sql ./share/postgresql/extension/openGauss_expr_dolphin.ir ./share/postgresql/extension/assessment--1.0.sql ./share/postgresql/extension/assessment.control diff --git a/build/script/x86_64_lite_list b/build/script/x86_64_lite_list index 62660db0e..b49cbef71 100644 --- a/build/script/x86_64_lite_list +++ b/build/script/x86_64_lite_list @@ -37,8 +37,10 @@ ./share/postgresql/extension/dolphin--1.0.sql ./share/postgresql/extension/dolphin--1.0--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.0.sql +./share/postgresql/extension/dolphin--2.0--2.0.1.sql ./share/postgresql/extension/dolphin--1.1--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.1.sql +./share/postgresql/extension/dolphin--2.0.1--2.0.sql ./share/postgresql/extension/openGauss_expr_dolphin.ir ./share/postgresql/extension/file_fdw--1.0.sql ./share/postgresql/extension/plpgsql.control diff --git a/build/script/x86_64_opengauss_list b/build/script/x86_64_opengauss_list index 69137a38f..4f1eee380 100644 --- a/build/script/x86_64_opengauss_list +++ b/build/script/x86_64_opengauss_list @@ -76,8 +76,10 @@ ./share/postgresql/extension/dolphin--1.0.sql ./share/postgresql/extension/dolphin--1.0--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.0.sql +./share/postgresql/extension/dolphin--2.0--2.0.1.sql ./share/postgresql/extension/dolphin--1.1--2.0.sql ./share/postgresql/extension/dolphin--2.0--1.1.sql +./share/postgresql/extension/dolphin--2.0.1--2.0.sql ./share/postgresql/extension/openGauss_expr_dolphin.ir ./share/postgresql/extension/assessment--1.0.sql ./share/postgresql/extension/assessment.control diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_906.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_906.sql index c03aaa2e2..9408933b6 100644 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_906.sql +++ b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_906.sql @@ -1,3 +1,16 @@ +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0.1'; + end if; + exit; + END LOOP; +END$$; + DROP FUNCTION IF EXISTS pg_catalog.ss_txnstatus_cache_stat() CASCADE; -- those type of view and producer will recreate. @@ -954,3 +967,16 @@ GRANT SELECT ON TABLE DBE_PERF.summary_statement TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.statement_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; + +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0.1') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0'; + end if; + exit; + END LOOP; +END$$; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_906.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_906.sql index f2a9f31ac..02fd35b98 100644 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_906.sql +++ b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_906.sql @@ -1,3 +1,15 @@ +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0.1'; + end if; + exit; + END LOOP; +END$$; DROP FUNCTION IF EXISTS pg_catalog.ss_txnstatus_cache_stat() CASCADE; -- those type of view and producer will recreate. @@ -955,3 +967,15 @@ GRANT SELECT ON TABLE DBE_PERF.statement_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0.1') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0'; + end if; + exit; + END LOOP; +END$$; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_906.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_906.sql index 518497b40..74f6fce90 100644 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_906.sql +++ b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_906.sql @@ -1,3 +1,16 @@ +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0.1'; + end if; + exit; + END LOOP; +END$$; + DROP FUNCTION IF EXISTS pg_catalog.ss_txnstatus_cache_stat() CASCADE; SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 8888; CREATE FUNCTION pg_catalog.ss_txnstatus_cache_stat( @@ -1139,4 +1152,17 @@ GRANT SELECT ON TABLE DBE_PERF.STATEMENT TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.summary_statement TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.statement_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_history TO PUBLIC; -GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; \ No newline at end of file +GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; + +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0.1') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0'; + end if; + exit; + END LOOP; +END$$; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_906.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_906.sql index 518497b40..74f6fce90 100644 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_906.sql +++ b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_906.sql @@ -1,3 +1,16 @@ +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0.1'; + end if; + exit; + END LOOP; +END$$; + DROP FUNCTION IF EXISTS pg_catalog.ss_txnstatus_cache_stat() CASCADE; SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 8888; CREATE FUNCTION pg_catalog.ss_txnstatus_cache_stat( @@ -1139,4 +1152,17 @@ GRANT SELECT ON TABLE DBE_PERF.STATEMENT TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.summary_statement TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.statement_history TO PUBLIC; GRANT SELECT ON TABLE DBE_PERF.global_slow_query_history TO PUBLIC; -GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; \ No newline at end of file +GRANT SELECT ON TABLE DBE_PERF.global_slow_query_info TO PUBLIC; + +do $$ +DECLARE +ans boolean; +BEGIN + for ans in select case when count(*)=1 then true else false end as ans from (select extname from pg_extension where extname='dolphin' and extversion = '2.0.1') + LOOP + if ans = true then + ALTER EXTENSION dolphin UPDATE TO '2.0'; + end if; + exit; + END LOOP; +END$$; \ No newline at end of file