From 353616ebbd1f45cab28c93ac5f93a789e0d88527 Mon Sep 17 00:00:00 2001 From: R3gardless Date: Tue, 17 Jun 2025 20:35:59 +0900 Subject: [PATCH 1/5] fix: add assign hook for CDC library path adjustment Add EnableChangeDataCaptureAssignHook to automatically adjust dynamic_library_path when citus.enable_change_data_capture is enabled, ensuring CDC decoders are properly loaded. --- src/backend/distributed/shared_library_init.c | 20 ++++- .../expected/cdc_library_path_test.out | 78 +++++++++++++++++++ src/test/regress/multi_schedule | 1 + .../regress/sql/cdc_library_path_test.sql | 62 +++++++++++++++ 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 src/test/regress/expected/cdc_library_path_test.out create mode 100644 src/test/regress/sql/cdc_library_path_test.sql diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 430eb8555..7591f49ce 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -215,6 +215,7 @@ static bool StatisticsCollectionGucCheckHook(bool *newval, void **extra, GucSour static void CitusAuthHook(Port *port, int status); static bool IsSuperuser(char *userName); static void AdjustDynamicLibraryPathForCdcDecoders(void); +static void EnableChangeDataCaptureAssignHook(bool newval, void *extra); static ClientAuthentication_hook_type original_client_auth_hook = NULL; static emit_log_hook_type original_emit_log_hook = NULL; @@ -597,7 +598,7 @@ AdjustDynamicLibraryPathForCdcDecoders(void) { if (strcmp(Dynamic_library_path, "$libdir") == 0) { - SetConfigOption("dynamic_library_path", CDC_DECODER_DYNAMIC_LIB_PATH, + SetConfigOption("dynamic_library_path", CDC_DECODER_DYNAMIC_LIB_PATH, PGC_POSTMASTER, PGC_S_OVERRIDE); } } @@ -1272,7 +1273,7 @@ RegisterCitusConfigVariables(void) false, PGC_USERSET, GUC_STANDARD, - NULL, NULL, NULL); + NULL, EnableChangeDataCaptureAssignHook, NULL); DefineCustomBoolVariable( "citus.enable_cluster_clock", @@ -3272,3 +3273,18 @@ CitusObjectAccessHook(ObjectAccessType access, Oid classId, Oid objectId, int su SetCreateCitusTransactionLevel(GetCurrentTransactionNestLevel()); } } + +/* + * EnableChangeDataCaptureAssignHook is called whenever the + * citus.enable_change_data_capture setting is changed to dynamically + * adjust the dynamic_library_path based on the new value. + */ +static void +EnableChangeDataCaptureAssignHook(bool newval, void *extra) +{ + if (newval) + { + /* CDC enabled: add citus_decoders to the path */ + AdjustDynamicLibraryPathForCdcDecoders(); + } +} diff --git a/src/test/regress/expected/cdc_library_path_test.out b/src/test/regress/expected/cdc_library_path_test.out new file mode 100644 index 000000000..bb56bb5db --- /dev/null +++ b/src/test/regress/expected/cdc_library_path_test.out @@ -0,0 +1,78 @@ +\set VERBOSITY terse +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + $libdir +(1 row) + +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +---------------------------------- + off +(1 row) + +SELECT current_setting('dynamic_library_path') AS initial_path; + initial_path +-------------- + $libdir +(1 row) + +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + $libdir +(1 row) + +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path correctly set' + ELSE 'CDC path not set' + END AS cdc_path_status; + cdc_path_status +----------------- + CDC path not set +(1 row) + +SET citus.enable_change_data_capture = false; +SET dynamic_library_path = '$libdir/custom_lib:$libdir'; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + $libdir/custom_lib:$libdir +(1 row) + +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +---------------------------------- + off +(1 row) + +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + $libdir +(1 row) + +SET dynamic_library_path = ''; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + +(1 row) + +SET dynamic_library_path = '/custom/path'; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +---------------------- + /custom/path +(1 row) + +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; diff --git a/src/test/regress/multi_schedule b/src/test/regress/multi_schedule index 3d7bd6e98..bb8208921 100644 --- a/src/test/regress/multi_schedule +++ b/src/test/regress/multi_schedule @@ -5,6 +5,7 @@ test: pg16 test: multi_create_fdw test: multi_test_catalog_views test: replicated_table_disable_node +test: cdc_library_path_test # ---------- # The following distributed tests depend on creating a partitioned table and diff --git a/src/test/regress/sql/cdc_library_path_test.sql b/src/test/regress/sql/cdc_library_path_test.sql new file mode 100644 index 000000000..126245850 --- /dev/null +++ b/src/test/regress/sql/cdc_library_path_test.sql @@ -0,0 +1,62 @@ +-- Test for CDC library path adjustment functionality +-- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function +-- correctly modifies the dynamic_library_path when CDC is enabled + +-- Save current settings +\set VERBOSITY terse + +-- Show initial dynamic_library_path +SHOW dynamic_library_path; + +-- Test 1: Verify CDC is initially disabled +SHOW citus.enable_change_data_capture; + +-- Test 2: Check that dynamic_library_path is default +SELECT current_setting('dynamic_library_path') AS initial_path; + +-- Test 3: Enable CDC and check if library path is adjusted +SET citus.enable_change_data_capture = true; + +-- Check if the path has been modified (should include citus_decoders) +SHOW dynamic_library_path; + +-- Test 4: Verify the path contains citus_decoders +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path correctly set' + ELSE 'CDC path not set' + END AS cdc_path_status; + +-- Test 5: Disable CDC +SET citus.enable_change_data_capture = false; + +-- Test 6: Test with custom library path +SET dynamic_library_path = '$libdir/custom_lib:$libdir'; +SET citus.enable_change_data_capture = true; + +-- Verify that custom paths are preserved when CDC is enabled +SHOW dynamic_library_path; + +-- Test 7: Reset to defaults +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; + +-- Final verification +SHOW citus.enable_change_data_capture; +SHOW dynamic_library_path; + +-- Test edge cases +-- Test 8: Test with empty library path +SET dynamic_library_path = ''; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + +-- Test 9: Test with non-standard library path +SET dynamic_library_path = '/custom/path'; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + +-- Clean up +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; From aea0d2907cb02cd7760ceacee1543852e9a48e32 Mon Sep 17 00:00:00 2001 From: R3gardless Date: Wed, 18 Jun 2025 20:39:03 +0900 Subject: [PATCH 2/5] fix: wrong indent --- src/backend/distributed/shared_library_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 7591f49ce..645072368 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -598,7 +598,7 @@ AdjustDynamicLibraryPathForCdcDecoders(void) { if (strcmp(Dynamic_library_path, "$libdir") == 0) { - SetConfigOption("dynamic_library_path", CDC_DECODER_DYNAMIC_LIB_PATH, + SetConfigOption("dynamic_library_path", CDC_DECODER_DYNAMIC_LIB_PATH, PGC_POSTMASTER, PGC_S_OVERRIDE); } } From 3cd6c579a410a0386d7ba026483c5ece4e1efe6e Mon Sep 17 00:00:00 2001 From: R3gardless Date: Mon, 23 Jun 2025 21:18:53 +0900 Subject: [PATCH 3/5] test: add comprehensive CDC library path adjustment tests - Add cdc_library_path.sql test to verify superuser CDC functionality - Add non_super_user_cdc_library_path.sql test for non-superuser scenarios - Set citus.enable_change_data_capture=off as default in test runner --- .../regress/expected/cdc_library_path.out | 81 +++++++++++++++++++ .../expected/cdc_library_path_test.out | 78 ------------------ .../non_super_user_cdc_library_path.out | 45 +++++++++++ src/test/regress/multi_schedule | 2 +- src/test/regress/pg_regress_multi.pl | 2 +- src/test/regress/sql/cdc_library_path.sql | 46 +++++++++++ .../regress/sql/cdc_library_path_test.sql | 62 -------------- .../sql/non_super_user_cdc_library_path.sql | 27 +++++++ 8 files changed, 201 insertions(+), 142 deletions(-) create mode 100644 src/test/regress/expected/cdc_library_path.out delete mode 100644 src/test/regress/expected/cdc_library_path_test.out create mode 100644 src/test/regress/expected/non_super_user_cdc_library_path.out create mode 100644 src/test/regress/sql/cdc_library_path.sql delete mode 100644 src/test/regress/sql/cdc_library_path_test.sql create mode 100644 src/test/regress/sql/non_super_user_cdc_library_path.sql diff --git a/src/test/regress/expected/cdc_library_path.out b/src/test/regress/expected/cdc_library_path.out new file mode 100644 index 000000000..4bf266bd1 --- /dev/null +++ b/src/test/regress/expected/cdc_library_path.out @@ -0,0 +1,81 @@ +-- Test for CDC library path adjustment functionality +-- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function with superuser privileges +-- correctly modifies the dynamic_library_path when CDC is enabled +-- Test 1: Show initial state and reset to ensure clean state +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir +(1 row) + +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +--------------------------------------------------------------------- + off +(1 row) + +-- Test 2: Enable CDC and verify path is set to include citus_decoders +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/citus_decoders:$libdir +(1 row) + +-- Verify that the dynamic_library_path has been modified to include citus_decoders +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path correctly set' + ELSE 'CDC path incorrectly not set' + END AS cdc_path_status; + cdc_path_status +--------------------------------------------------------------------- + CDC path correctly set +(1 row) + +-- Test 3: Disable CDC and verify path remains (CDC doesn't remove the path) +SET citus.enable_change_data_capture = false; +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/citus_decoders:$libdir +(1 row) + +-- Test 4: Edge case - function should only work when path is exactly "$libdir" +SET dynamic_library_path = '$libdir/other_path:$libdir'; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/other_path:$libdir +(1 row) + +-- Verify that path is unchanged with custom library path +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path incorrectly set' + ELSE 'CDC path correctly not set' + END AS custom_path_test; + custom_path_test +--------------------------------------------------------------------- + CDC path correctly not set +(1 row) + +-- Reset dynamic_library_path to default +RESET dynamic_library_path; +RESET citus.enable_change_data_capture; +-- Test 5: Verify that dynamic_library_path reset_val is overridden to $libdir/citus_decoders:$libdir +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/citus_decoders:$libdir +(1 row) + +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +--------------------------------------------------------------------- + off +(1 row) + diff --git a/src/test/regress/expected/cdc_library_path_test.out b/src/test/regress/expected/cdc_library_path_test.out deleted file mode 100644 index bb56bb5db..000000000 --- a/src/test/regress/expected/cdc_library_path_test.out +++ /dev/null @@ -1,78 +0,0 @@ -\set VERBOSITY terse -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - $libdir -(1 row) - -SHOW citus.enable_change_data_capture; - citus.enable_change_data_capture ----------------------------------- - off -(1 row) - -SELECT current_setting('dynamic_library_path') AS initial_path; - initial_path --------------- - $libdir -(1 row) - -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - $libdir -(1 row) - -SELECT - CASE - WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' - THEN 'CDC path correctly set' - ELSE 'CDC path not set' - END AS cdc_path_status; - cdc_path_status ------------------ - CDC path not set -(1 row) - -SET citus.enable_change_data_capture = false; -SET dynamic_library_path = '$libdir/custom_lib:$libdir'; -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - $libdir/custom_lib:$libdir -(1 row) - -RESET citus.enable_change_data_capture; -RESET dynamic_library_path; -SHOW citus.enable_change_data_capture; - citus.enable_change_data_capture ----------------------------------- - off -(1 row) - -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - $libdir -(1 row) - -SET dynamic_library_path = ''; -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - -(1 row) - -SET dynamic_library_path = '/custom/path'; -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - dynamic_library_path ----------------------- - /custom/path -(1 row) - -RESET citus.enable_change_data_capture; -RESET dynamic_library_path; diff --git a/src/test/regress/expected/non_super_user_cdc_library_path.out b/src/test/regress/expected/non_super_user_cdc_library_path.out new file mode 100644 index 000000000..651bd2ff4 --- /dev/null +++ b/src/test/regress/expected/non_super_user_cdc_library_path.out @@ -0,0 +1,45 @@ +-- Test for CDC library path adjustment functionality +-- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function with non-superuser privileges +-- correctly modifies the dynamic_library_path when CDC is enabled +-- Test 1: Non-superuser with read_all_settings can see dynamic_library_path changes +CREATE USER cdc_test_user; +GRANT pg_read_all_settings TO cdc_test_user; +SET ROLE cdc_test_user; +-- Non-superuser should be able to see the current dynamic_library_path +SELECT current_setting('dynamic_library_path') AS user_visible_path; + user_visible_path +--------------------------------------------------------------------- + $libdir +(1 row) + +SET citus.enable_change_data_capture = true; +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +--------------------------------------------------------------------- + on +(1 row) + +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/citus_decoders:$libdir +(1 row) + +-- Reset to superuser and cleanup +RESET ROLE; +DROP USER cdc_test_user; +-- Final cleanup +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; +SHOW citus.enable_change_data_capture; + citus.enable_change_data_capture +--------------------------------------------------------------------- + off +(1 row) + +SHOW dynamic_library_path; + dynamic_library_path +--------------------------------------------------------------------- + $libdir/citus_decoders:$libdir +(1 row) + diff --git a/src/test/regress/multi_schedule b/src/test/regress/multi_schedule index bb8208921..e89d9075d 100644 --- a/src/test/regress/multi_schedule +++ b/src/test/regress/multi_schedule @@ -5,7 +5,7 @@ test: pg16 test: multi_create_fdw test: multi_test_catalog_views test: replicated_table_disable_node -test: cdc_library_path_test +test: cdc_library_path non_super_user_cdc_library_path # ---------- # The following distributed tests depend on creating a partitioned table and diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index 17c0a1179..161880436 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -489,7 +489,7 @@ push(@pgOptions, "citus.explain_analyze_sort_method='taskId'"); push(@pgOptions, "citus.enable_manual_changes_to_shards=on"); push(@pgOptions, "citus.allow_unsafe_locks_from_workers=on"); push(@pgOptions, "citus.stat_statements_track = 'all'"); -push(@pgOptions, "citus.enable_change_data_capture=on"); +push(@pgOptions, "citus.enable_change_data_capture=off"); push(@pgOptions, "citus.stat_tenants_limit = 2"); push(@pgOptions, "citus.stat_tenants_track = 'ALL'"); push(@pgOptions, "citus.enable_stat_counters=on"); diff --git a/src/test/regress/sql/cdc_library_path.sql b/src/test/regress/sql/cdc_library_path.sql new file mode 100644 index 000000000..17fb5c798 --- /dev/null +++ b/src/test/regress/sql/cdc_library_path.sql @@ -0,0 +1,46 @@ +-- Test for CDC library path adjustment functionality +-- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function with superuser privileges +-- correctly modifies the dynamic_library_path when CDC is enabled + +-- Test 1: Show initial state and reset to ensure clean state +SHOW dynamic_library_path; +SHOW citus.enable_change_data_capture; + +-- Test 2: Enable CDC and verify path is set to include citus_decoders +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + +-- Verify that the dynamic_library_path has been modified to include citus_decoders +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path correctly set' + ELSE 'CDC path incorrectly not set' + END AS cdc_path_status; + +-- Test 3: Disable CDC and verify path remains (CDC doesn't remove the path) +SET citus.enable_change_data_capture = false; +SHOW dynamic_library_path; + +-- Test 4: Edge case - function should only work when path is exactly "$libdir" +SET dynamic_library_path = '$libdir/other_path:$libdir'; +SET citus.enable_change_data_capture = true; +SHOW dynamic_library_path; + +-- Verify that path is unchanged with custom library path +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' + THEN 'CDC path incorrectly set' + ELSE 'CDC path correctly not set' + END AS custom_path_test; + +-- Reset dynamic_library_path to default +RESET dynamic_library_path; +RESET citus.enable_change_data_capture; + +-- Test 5: Verify that dynamic_library_path reset_val is overridden to $libdir/citus_decoders:$libdir +SHOW dynamic_library_path; +SHOW citus.enable_change_data_capture; + + diff --git a/src/test/regress/sql/cdc_library_path_test.sql b/src/test/regress/sql/cdc_library_path_test.sql deleted file mode 100644 index 126245850..000000000 --- a/src/test/regress/sql/cdc_library_path_test.sql +++ /dev/null @@ -1,62 +0,0 @@ --- Test for CDC library path adjustment functionality --- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function --- correctly modifies the dynamic_library_path when CDC is enabled - --- Save current settings -\set VERBOSITY terse - --- Show initial dynamic_library_path -SHOW dynamic_library_path; - --- Test 1: Verify CDC is initially disabled -SHOW citus.enable_change_data_capture; - --- Test 2: Check that dynamic_library_path is default -SELECT current_setting('dynamic_library_path') AS initial_path; - --- Test 3: Enable CDC and check if library path is adjusted -SET citus.enable_change_data_capture = true; - --- Check if the path has been modified (should include citus_decoders) -SHOW dynamic_library_path; - --- Test 4: Verify the path contains citus_decoders -SELECT - CASE - WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' - THEN 'CDC path correctly set' - ELSE 'CDC path not set' - END AS cdc_path_status; - --- Test 5: Disable CDC -SET citus.enable_change_data_capture = false; - --- Test 6: Test with custom library path -SET dynamic_library_path = '$libdir/custom_lib:$libdir'; -SET citus.enable_change_data_capture = true; - --- Verify that custom paths are preserved when CDC is enabled -SHOW dynamic_library_path; - --- Test 7: Reset to defaults -RESET citus.enable_change_data_capture; -RESET dynamic_library_path; - --- Final verification -SHOW citus.enable_change_data_capture; -SHOW dynamic_library_path; - --- Test edge cases --- Test 8: Test with empty library path -SET dynamic_library_path = ''; -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - --- Test 9: Test with non-standard library path -SET dynamic_library_path = '/custom/path'; -SET citus.enable_change_data_capture = true; -SHOW dynamic_library_path; - --- Clean up -RESET citus.enable_change_data_capture; -RESET dynamic_library_path; diff --git a/src/test/regress/sql/non_super_user_cdc_library_path.sql b/src/test/regress/sql/non_super_user_cdc_library_path.sql new file mode 100644 index 000000000..748a71a5d --- /dev/null +++ b/src/test/regress/sql/non_super_user_cdc_library_path.sql @@ -0,0 +1,27 @@ +-- Test for CDC library path adjustment functionality +-- This test verifies that the AdjustDynamicLibraryPathForCdcDecoders function with non-superuser privileges +-- correctly modifies the dynamic_library_path when CDC is enabled + +-- Test 1: Non-superuser with read_all_settings can see dynamic_library_path changes +CREATE USER cdc_test_user; +GRANT pg_read_all_settings TO cdc_test_user; +SET ROLE cdc_test_user; + +-- Non-superuser should be able to see the current dynamic_library_path +SELECT current_setting('dynamic_library_path') AS user_visible_path; + +SET citus.enable_change_data_capture = true; + +SHOW citus.enable_change_data_capture; +SHOW dynamic_library_path; + +-- Reset to superuser and cleanup +RESET ROLE; +DROP USER cdc_test_user; + +-- Final cleanup +RESET citus.enable_change_data_capture; +RESET dynamic_library_path; + +SHOW citus.enable_change_data_capture; +SHOW dynamic_library_path; \ No newline at end of file From 0b246f4770153dcba4da2df23300c5e0666378de Mon Sep 17 00:00:00 2001 From: R3gardless Date: Mon, 23 Jun 2025 21:35:50 +0900 Subject: [PATCH 4/5] style : execute citus_indent --- src/backend/distributed/shared_library_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 645072368..aed6cdf32 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -3274,14 +3274,15 @@ CitusObjectAccessHook(ObjectAccessType access, Oid classId, Oid objectId, int su } } + /* - * EnableChangeDataCaptureAssignHook is called whenever the + * EnableChangeDataCaptureAssignHook is called whenever the * citus.enable_change_data_capture setting is changed to dynamically * adjust the dynamic_library_path based on the new value. */ static void EnableChangeDataCaptureAssignHook(bool newval, void *extra) -{ +{ if (newval) { /* CDC enabled: add citus_decoders to the path */ From 7104b8a5417c2cbedc2e23e450a50912c0e4de23 Mon Sep 17 00:00:00 2001 From: Hanefi Onaldi Date: Mon, 23 Jun 2025 22:01:31 +0300 Subject: [PATCH 5/5] Fix style --- src/test/regress/sql/cdc_library_path.sql | 12 ++++++------ .../regress/sql/non_super_user_cdc_library_path.sql | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/regress/sql/cdc_library_path.sql b/src/test/regress/sql/cdc_library_path.sql index 17fb5c798..32341408f 100644 --- a/src/test/regress/sql/cdc_library_path.sql +++ b/src/test/regress/sql/cdc_library_path.sql @@ -11,9 +11,9 @@ SET citus.enable_change_data_capture = true; SHOW dynamic_library_path; -- Verify that the dynamic_library_path has been modified to include citus_decoders -SELECT - CASE - WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' THEN 'CDC path correctly set' ELSE 'CDC path incorrectly not set' END AS cdc_path_status; @@ -28,9 +28,9 @@ SET citus.enable_change_data_capture = true; SHOW dynamic_library_path; -- Verify that path is unchanged with custom library path -SELECT - CASE - WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' +SELECT + CASE + WHEN current_setting('dynamic_library_path') LIKE '%citus_decoders%' THEN 'CDC path incorrectly set' ELSE 'CDC path correctly not set' END AS custom_path_test; diff --git a/src/test/regress/sql/non_super_user_cdc_library_path.sql b/src/test/regress/sql/non_super_user_cdc_library_path.sql index 748a71a5d..2fac4ad8f 100644 --- a/src/test/regress/sql/non_super_user_cdc_library_path.sql +++ b/src/test/regress/sql/non_super_user_cdc_library_path.sql @@ -24,4 +24,4 @@ RESET citus.enable_change_data_capture; RESET dynamic_library_path; SHOW citus.enable_change_data_capture; -SHOW dynamic_library_path; \ No newline at end of file +SHOW dynamic_library_path;