@@ -72,7 +72,9 @@ class XClusterPgRegressDDLReplicationTest : public XClusterDDLReplicationTestBas
72
72
" , " , " \n " ));
73
73
}
74
74
75
- void ExecutePgFile (const std::string& file_path) {
75
+ void ExecutePgFile (const std::string& file_path) { ExecutePgFile (file_path, namespace_name); }
76
+
77
+ void ExecutePgFile (const std::string& file_path, const std::string& database_name) {
76
78
std::vector<std::string> args;
77
79
args.push_back (GetPgToolPath (" ysqlsh" ));
78
80
args.push_back (" --host" );
@@ -83,6 +85,8 @@ class XClusterPgRegressDDLReplicationTest : public XClusterDDLReplicationTestBas
83
85
args.push_back (" --variable=ON_ERROR_STOP=1" );
84
86
args.push_back (" -f" );
85
87
args.push_back (file_path);
88
+ args.push_back (" -d" );
89
+ args.push_back (database_name);
86
90
87
91
auto s = CallAdminVec (args);
88
92
LOG (INFO) << " Command output: " << s;
@@ -98,7 +102,7 @@ class XClusterPgRegressDDLReplicationTest : public XClusterDDLReplicationTestBas
98
102
RETURN_NOT_OK (SetUpClusters ());
99
103
100
104
// Perturb OIDs on consumer side to make sure we don't accidentally preserve OIDs.
101
- auto conn = VERIFY_RESULT (consumer_cluster_.ConnectToDB (" yugabyte " ));
105
+ auto conn = VERIFY_RESULT (consumer_cluster_.ConnectToDB (namespace_name ));
102
106
RETURN_NOT_OK (
103
107
conn.Execute (" CREATE TYPE gratuitous_enum AS ENUM ('red', 'orange', 'yellow', 'green', "
104
108
" 'blue', 'purple');" ));
@@ -111,7 +115,8 @@ class XClusterPgRegressDDLReplicationTest : public XClusterDDLReplicationTestBas
111
115
// Some of the scripts do take a long time to run so setting this timeout high.
112
116
propagation_timeout_ = MonoDelta::FromMinutes (4 * kTimeMultiplier );
113
117
114
- // First run just the create table part of the file, then run the drop parts.
118
+ // First run just the create part of the file, then run the drop parts.
119
+ std::string initial_dump = " " ;
115
120
for (const auto & file_name : {create_file_name, drop_file_name}) {
116
121
if (file_name.empty ()) {
117
122
continue ;
@@ -126,6 +131,14 @@ class XClusterPgRegressDDLReplicationTest : public XClusterDDLReplicationTestBas
126
131
auto producer_dump = VERIFY_RESULT (RunYSQLDump (producer_cluster_));
127
132
auto consumer_dump = VERIFY_RESULT (RunYSQLDump (consumer_cluster_));
128
133
SCHECK_EQ (producer_dump, consumer_dump, IllegalState, " Ysqldumps do not match" );
134
+ // Ensure that the dump is not empty, should at least contain the extension.
135
+ if (initial_dump.empty ()) {
136
+ initial_dump = producer_dump;
137
+ } else {
138
+ // Check to ensure that the test is working properly.
139
+ SCHECK_NE (
140
+ initial_dump, producer_dump, IllegalState, " Ysqldumps after drops should not match" );
141
+ }
129
142
130
143
auto producer_enum_label_info = VERIFY_RESULT (ReadEnumLabelInfo (producer_cluster_));
131
144
auto consumer_enum_label_info = VERIFY_RESULT (ReadEnumLabelInfo (consumer_cluster_));
0 commit comments