-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#2553) This commit implements a wrapper function for all the checks to detect inconsistency between babelfish catalogs and pg catalogs. As of now, we are only checking the metadata consistency between these catalogs. Task: BABEL-4139 Signed-off-by: Roshan Kanwar <[email protected]>
- Loading branch information
1 parent
288cf89
commit 688142e
Showing
13 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
.github/composite-actions/check-babelfish-inconsistency/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: 'Check Babelfish metadata inconsistency' | ||
description: Check for Babelfish metadata inconsistency before Major/Minor Version Upgrade | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Check Babelfish metadata inconsistency | ||
id: check-babelfish-inconsistency | ||
run: | | ||
output=$(sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT sys.check_for_inconsistent_metadata() GO" | tail -n +2) | ||
echo "check_result=$output" >> "$GITHUB_OUTPUT" | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/JDBC/expected/check_for_inconsistent_metadata-vu-cleanup.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP FUNCTION IF EXISTS check_for_inconsistent_metadata_vu_prepare_func | ||
GO |
7 changes: 7 additions & 0 deletions
7
test/JDBC/expected/check_for_inconsistent_metadata-vu-prepare.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE FUNCTION check_for_inconsistent_metadata_vu_prepare_func() | ||
RETURNS BOOLEAN | ||
AS | ||
BEGIN | ||
RETURN (SELECT sys.check_for_inconsistent_metadata()) | ||
END | ||
GO |
50 changes: 50 additions & 0 deletions
50
test/JDBC/expected/check_for_inconsistent_metadata-vu-verify.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
-- psql | ||
|
||
|
||
|
||
|
||
|
||
-- Updating one entry from pg_proc pg catalog so that metadata inconsistency fails during check against babelfish_function_ext babelfish catalog | ||
UPDATE pg_catalog.pg_proc SET proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong' WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func'; | ||
SELECT proname, prosrc FROM pg_catalog.pg_proc WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong'; | ||
SELECT nspname, funcname FROM sys.babelfish_function_ext WHERE funcname = 'check_for_inconsistent_metadata_vu_prepare_func'; | ||
-- should return true because of inconsistency | ||
SELECT sys.check_for_inconsistent_metadata(); | ||
-- should return the inconsistent row data | ||
SELECT sys.babelfish_inconsistent_metadata(); | ||
UPDATE pg_catalog.pg_proc SET proname = 'check_for_inconsistent_metadata_vu_prepare_func' WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong'; | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
~~START~~ | ||
name#!#text | ||
check_for_inconsistent_metadata_vu_prepare_func_wrong#!#BEGIN<newline>RETURN (SELECT sys.check_for_inconsistent_metadata())<newline>END | ||
~~END~~ | ||
|
||
~~START~~ | ||
name#!#name | ||
master_dbo#!#check_for_inconsistent_metadata_vu_prepare_func | ||
~~END~~ | ||
|
||
~~START~~ | ||
bool | ||
t | ||
~~END~~ | ||
|
||
~~START~~ | ||
record | ||
(name,pg_catalog,proname,"{""Rule"": ""<funcname> in babelfish_function_ext must also exist in pg_proc""}") | ||
~~END~~ | ||
|
||
~~ROW COUNT: 1~~ | ||
|
||
|
||
-- tsql | ||
-- since data is consistent now, this should return 0 | ||
SELECT check_for_inconsistent_metadata_vu_prepare_func() | ||
GO | ||
~~START~~ | ||
bit | ||
0 | ||
~~END~~ | ||
|
2 changes: 2 additions & 0 deletions
2
test/JDBC/input/check_for_inconsistent_metadata-vu-cleanup.mix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP FUNCTION IF EXISTS check_for_inconsistent_metadata_vu_prepare_func | ||
GO |
7 changes: 7 additions & 0 deletions
7
test/JDBC/input/check_for_inconsistent_metadata-vu-prepare.mix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE FUNCTION check_for_inconsistent_metadata_vu_prepare_func() | ||
RETURNS BOOLEAN | ||
AS | ||
BEGIN | ||
RETURN (SELECT sys.check_for_inconsistent_metadata()) | ||
END | ||
GO |
21 changes: 21 additions & 0 deletions
21
test/JDBC/input/check_for_inconsistent_metadata-vu-verify.mix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Updating one entry from pg_proc pg catalog so that metadata inconsistency fails during check against babelfish_function_ext babelfish catalog | ||
-- psql | ||
UPDATE pg_catalog.pg_proc SET proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong' WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func'; | ||
|
||
SELECT proname, prosrc FROM pg_catalog.pg_proc WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong'; | ||
|
||
SELECT nspname, funcname FROM sys.babelfish_function_ext WHERE funcname = 'check_for_inconsistent_metadata_vu_prepare_func'; | ||
|
||
-- should return true because of inconsistency | ||
SELECT sys.check_for_inconsistent_metadata(); | ||
|
||
-- should return the inconsistent row data | ||
SELECT sys.babelfish_inconsistent_metadata(); | ||
|
||
UPDATE pg_catalog.pg_proc SET proname = 'check_for_inconsistent_metadata_vu_prepare_func' WHERE proname = 'check_for_inconsistent_metadata_vu_prepare_func_wrong'; | ||
GO | ||
|
||
-- tsql | ||
-- since data is consistent now, this should return 0 | ||
SELECT check_for_inconsistent_metadata_vu_prepare_func() | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters