forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with datatypes for Logical Replication (babelfish-for-post…
…gresql#2268) This commit fixes following issues: 1. (Var)binary columns are not replicated correctly since input function considers the value as a raw ASCII string although the value is actually already in binary format. Fixed this by using IsLogicalWorker() with existing TSQLHexConstTypmod check in varbinaryin function to correctly take binary input sent by the publisher. 2. SQL_VARIANT columns are replicated correctly as far as the data contents are concerned, but the meta data is lost in the process which is because sql_variant output function returns the value in the respective datatype in string format which when fed back to the sql_variant input function gets treated as a varchar value. Fixed this by replicating sql_variant values as bytea. We will use MyReplicationSlot and MyWalSnd in sqlvariantout function on publisher and IsLogicalWorker() in sqlvariantin function on subscriber to identify if we are in logical replication context. 3. On the subscriber side, IsLogicalWorker() is sufficient for native PG applyworker but will not work with external providers like pglogical, so will rely on SessionReplicationRole being replica since most of the providers seem to set this GUC. Additionally, this adds support to run logical replication tests in github action along with JDBC framework. Task: BABEL-3427, BABEL-4049 Signed-off-by: Rishabh Tanwar [email protected]
- Loading branch information
1 parent
07993e5
commit 214ea58
Showing
12 changed files
with
931 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
name: 'Run JDBC Tests' | ||
description: 'Run Babel JDBC test framework' | ||
|
||
inputs: | ||
input_dir: | ||
description: 'Test input directory' | ||
required: no | ||
default: input | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run JDBC Tests | ||
run: | | ||
export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH | ||
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish | ||
export inputFilesPath=${{inputs.input_dir}} | ||
cd test/JDBC/ | ||
mvn test | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef LOGICAL_H | ||
#define LOGICAL_H | ||
|
||
#include "postgres.h" | ||
|
||
/* | ||
* IsLogicalWorker() is sufficient for native PG applyworker but will | ||
* not work with external providers like pglogical, so will rely on | ||
* SessionReplicationRole being replica since most of the providers seem | ||
* to set this GUC. | ||
*/ | ||
#define IS_LOGICAL_RECEIVER() (IsLogicalWorker() || SessionReplicationRole == SESSION_REPLICATION_ROLE_REPLICA) | ||
|
||
/* | ||
* There are two criterias for walsender: | ||
* 1. MyReplicationSlot is logical. | ||
* 2. This is a logical walsender process. | ||
*/ | ||
#define IS_LOGICAL_SENDER() \ | ||
((MyReplicationSlot != NULL && SlotIsLogical(MyReplicationSlot)) || \ | ||
(MyWalSnd != NULL && MyWalSnd->kind == REPLICATION_KIND_LOGICAL)) | ||
|
||
#endif /* LOGICAL_H */ |
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
Oops, something went wrong.