@@ -97,17 +97,19 @@ private static Object getCommand(String arg) {
9797 * @param schemaFilePath path to schema file.
9898 * @param options specific options for creating tables.
9999 * @param createCoordinatorTables create coordinator tables or not.
100+ * @param createReplicationTables create replication tables or not.
100101 * @throws SchemaLoaderException thrown when creating tables fails.
101102 */
102103 public static void load (
103104 Properties configProperties ,
104105 @ Nullable Path schemaFilePath ,
105106 Map <String , String > options ,
106- boolean createCoordinatorTables )
107+ boolean createCoordinatorTables ,
108+ boolean createReplicationTables )
107109 throws SchemaLoaderException {
108110 Either <Path , Properties > config = new Right <>(configProperties );
109111 Either <Path , String > schema = new Left <>(schemaFilePath );
110- load (config , schema , options , createCoordinatorTables );
112+ load (config , schema , options , createCoordinatorTables , createReplicationTables );
111113 }
112114
113115 /**
@@ -117,17 +119,19 @@ public static void load(
117119 * @param schemaFilePath path to schema file.
118120 * @param options specific options for creating tables.
119121 * @param createCoordinatorTables create coordinator tables or not.
122+ * @param createReplicationTables create replication tables or not.
120123 * @throws SchemaLoaderException thrown when creating tables fails.
121124 */
122125 public static void load (
123126 Path configFilePath ,
124127 @ Nullable Path schemaFilePath ,
125128 Map <String , String > options ,
126- boolean createCoordinatorTables )
129+ boolean createCoordinatorTables ,
130+ boolean createReplicationTables )
127131 throws SchemaLoaderException {
128132 Either <Path , Properties > config = new Left <>(configFilePath );
129133 Either <Path , String > schema = new Left <>(schemaFilePath );
130- load (config , schema , options , createCoordinatorTables );
134+ load (config , schema , options , createCoordinatorTables , createReplicationTables );
131135 }
132136
133137 /**
@@ -137,17 +141,19 @@ public static void load(
137141 * @param serializedSchemaJson serialized json string schema.
138142 * @param options specific options for creating tables.
139143 * @param createCoordinatorTables create coordinator tables or not.
144+ * @param createReplicationTables create replication tables or not.
140145 * @throws SchemaLoaderException thrown when creating tables fails.
141146 */
142147 public static void load (
143148 Properties configProperties ,
144149 @ Nullable String serializedSchemaJson ,
145150 Map <String , String > options ,
146- boolean createCoordinatorTables )
151+ boolean createCoordinatorTables ,
152+ boolean createReplicationTables )
147153 throws SchemaLoaderException {
148154 Either <Path , Properties > config = new Right <>(configProperties );
149155 Either <Path , String > schema = new Right <>(serializedSchemaJson );
150- load (config , schema , options , createCoordinatorTables );
156+ load (config , schema , options , createCoordinatorTables , createReplicationTables );
151157 }
152158
153159 /**
@@ -157,17 +163,19 @@ public static void load(
157163 * @param serializedSchemaJson serialized json string schema.
158164 * @param options specific options for creating tables.
159165 * @param createCoordinatorTables create coordinator tables or not.
166+ * @param createReplicationTables create replication tables or not.
160167 * @throws SchemaLoaderException thrown when creating tables fails.
161168 */
162169 public static void load (
163170 Path configFilePath ,
164171 @ Nullable String serializedSchemaJson ,
165172 Map <String , String > options ,
166- boolean createCoordinatorTables )
173+ boolean createCoordinatorTables ,
174+ boolean createReplicationTables )
167175 throws SchemaLoaderException {
168176 Either <Path , Properties > config = new Left <>(configFilePath );
169177 Either <Path , String > schema = new Right <>(serializedSchemaJson );
170- load (config , schema , options , createCoordinatorTables );
178+ load (config , schema , options , createCoordinatorTables , createReplicationTables );
171179 }
172180
173181 /**
@@ -177,13 +185,15 @@ public static void load(
177185 * @param schema schema definition.
178186 * @param options specific options for creating tables.
179187 * @param createCoordinatorTables create coordinator tables or not.
188+ * @param createReplicationTables create replication tables or not.
180189 * @throws SchemaLoaderException thrown when creating tables fails.
181190 */
182191 private static void load (
183192 Either <Path , Properties > config ,
184193 Either <Path , String > schema ,
185194 Map <String , String > options ,
186- boolean createCoordinatorTables )
195+ boolean createCoordinatorTables ,
196+ boolean createReplicationTables )
187197 throws SchemaLoaderException {
188198 // Parse the schema
189199 List <TableSchema > tableSchemaList = getTableSchemaList (schema , options );
@@ -194,6 +204,9 @@ private static void load(
194204 if (createCoordinatorTables ) {
195205 operator .createCoordinatorTables (options );
196206 }
207+ if (createReplicationTables ) {
208+ operator .createReplicationTables (options );
209+ }
197210 }
198211 }
199212
@@ -203,14 +216,18 @@ private static void load(
203216 * @param configProperties ScalarDB config properties.
204217 * @param schemaFilePath path to schema file.
205218 * @param deleteCoordinatorTables delete coordinator tables or not.
219+ * @param deleteReplicationTables delete replication tables or not.
206220 * @throws SchemaLoaderException thrown when deleting tables fails.
207221 */
208222 public static void unload (
209- Properties configProperties , @ Nullable Path schemaFilePath , boolean deleteCoordinatorTables )
223+ Properties configProperties ,
224+ @ Nullable Path schemaFilePath ,
225+ boolean deleteCoordinatorTables ,
226+ boolean deleteReplicationTables )
210227 throws SchemaLoaderException {
211228 Either <Path , Properties > config = new Right <>(configProperties );
212229 Either <Path , String > schema = new Left <>(schemaFilePath );
213- unload (config , schema , deleteCoordinatorTables );
230+ unload (config , schema , deleteCoordinatorTables , deleteReplicationTables );
214231 }
215232
216233 /**
@@ -219,14 +236,18 @@ public static void unload(
219236 * @param configFilePath path to ScalarDB config file.
220237 * @param schemaFilePath path to schema file.
221238 * @param deleteCoordinatorTables delete coordinator tables or not.
239+ * @param deleteReplicationTables delete replication tables or not.
222240 * @throws SchemaLoaderException thrown when deleting tables fails.
223241 */
224242 public static void unload (
225- Path configFilePath , @ Nullable Path schemaFilePath , boolean deleteCoordinatorTables )
243+ Path configFilePath ,
244+ @ Nullable Path schemaFilePath ,
245+ boolean deleteCoordinatorTables ,
246+ boolean deleteReplicationTables )
226247 throws SchemaLoaderException {
227248 Either <Path , Properties > config = new Left <>(configFilePath );
228249 Either <Path , String > schema = new Left <>(schemaFilePath );
229- unload (config , schema , deleteCoordinatorTables );
250+ unload (config , schema , deleteCoordinatorTables , deleteReplicationTables );
230251 }
231252
232253 /**
@@ -235,16 +256,18 @@ public static void unload(
235256 * @param configProperties ScalarDB config properties.
236257 * @param serializedSchemaJson serialized json string schema.
237258 * @param deleteCoordinatorTables delete coordinator tables or not.
259+ * @param deleteReplicationTables delete replication tables or not.
238260 * @throws SchemaLoaderException thrown when deleting tables fails.
239261 */
240262 public static void unload (
241263 Properties configProperties ,
242264 @ Nullable String serializedSchemaJson ,
243- boolean deleteCoordinatorTables )
265+ boolean deleteCoordinatorTables ,
266+ boolean deleteReplicationTables )
244267 throws SchemaLoaderException {
245268 Either <Path , Properties > config = new Right <>(configProperties );
246269 Either <Path , String > schema = new Right <>(serializedSchemaJson );
247- unload (config , schema , deleteCoordinatorTables );
270+ unload (config , schema , deleteCoordinatorTables , deleteReplicationTables );
248271 }
249272
250273 /**
@@ -253,14 +276,18 @@ public static void unload(
253276 * @param configFilePath path to ScalarDB config file.
254277 * @param serializedSchemaJson serialized json string schema.
255278 * @param deleteCoordinatorTables delete coordinator tables or not.
279+ * @param deleteReplicationTables delete replication tables or not.
256280 * @throws SchemaLoaderException thrown when deleting tables fails.
257281 */
258282 public static void unload (
259- Path configFilePath , @ Nullable String serializedSchemaJson , boolean deleteCoordinatorTables )
283+ Path configFilePath ,
284+ @ Nullable String serializedSchemaJson ,
285+ boolean deleteCoordinatorTables ,
286+ boolean deleteReplicationTables )
260287 throws SchemaLoaderException {
261288 Either <Path , Properties > config = new Left <>(configFilePath );
262289 Either <Path , String > schema = new Right <>(serializedSchemaJson );
263- unload (config , schema , deleteCoordinatorTables );
290+ unload (config , schema , deleteCoordinatorTables , deleteReplicationTables );
264291 }
265292
266293 /**
@@ -269,10 +296,14 @@ public static void unload(
269296 * @param config ScalarDB config.
270297 * @param schema schema definition.
271298 * @param deleteCoordinatorTables delete coordinator tables or not.
299+ * @param deleteReplicationTables delete replication tables or not.
272300 * @throws SchemaLoaderException thrown when deleting tables fails.
273301 */
274302 private static void unload (
275- Either <Path , Properties > config , Either <Path , String > schema , boolean deleteCoordinatorTables )
303+ Either <Path , Properties > config ,
304+ Either <Path , String > schema ,
305+ boolean deleteCoordinatorTables ,
306+ boolean deleteReplicationTables )
276307 throws SchemaLoaderException {
277308 // Parse the schema
278309 List <TableSchema > tableSchemaList = getTableSchemaList (schema , Collections .emptyMap ());
@@ -283,6 +314,9 @@ private static void unload(
283314 if (deleteCoordinatorTables ) {
284315 operator .dropCoordinatorTables ();
285316 }
317+ if (deleteReplicationTables ) {
318+ operator .dropReplicationTables ();
319+ }
286320 }
287321 }
288322
@@ -296,17 +330,19 @@ private static void unload(
296330 * @param serializedSchemaJson serialized json string schema.
297331 * @param options specific options for repairing.
298332 * @param repairCoordinatorTable repair coordinator tables or not.
333+ * @param repairReplicationTable repair replication tables or not.
299334 * @throws SchemaLoaderException thrown when repairing fails.
300335 */
301336 public static void repairAll (
302337 Properties configProperties ,
303338 String serializedSchemaJson ,
304339 Map <String , String > options ,
305- boolean repairCoordinatorTable )
340+ boolean repairCoordinatorTable ,
341+ boolean repairReplicationTable )
306342 throws SchemaLoaderException {
307343 Either <Path , Properties > config = new Right <>(configProperties );
308344 Either <Path , String > schema = new Right <>(serializedSchemaJson );
309- repairAll (config , schema , options , repairCoordinatorTable );
345+ repairAll (config , schema , options , repairCoordinatorTable , repairReplicationTable );
310346 }
311347
312348 /**
@@ -319,17 +355,19 @@ public static void repairAll(
319355 * @param schemaPath path to the schema file.
320356 * @param options specific options for repairing.
321357 * @param repairCoordinatorTable repair coordinator tables or not.
358+ * @param repairReplicationTable repair replication tables or not.
322359 * @throws SchemaLoaderException thrown when repairing fails.
323360 */
324361 public static void repairAll (
325362 Properties configProperties ,
326363 Path schemaPath ,
327364 Map <String , String > options ,
328- boolean repairCoordinatorTable )
365+ boolean repairCoordinatorTable ,
366+ boolean repairReplicationTable )
329367 throws SchemaLoaderException {
330368 Either <Path , Properties > config = new Right <>(configProperties );
331369 Either <Path , String > schema = new Left <>(schemaPath );
332- repairAll (config , schema , options , repairCoordinatorTable );
370+ repairAll (config , schema , options , repairCoordinatorTable , repairReplicationTable );
333371 }
334372
335373 /**
@@ -342,17 +380,19 @@ public static void repairAll(
342380 * @param serializedSchemaJson serialized json string schema.
343381 * @param options specific options for repairing.
344382 * @param repairCoordinatorTable repair coordinator tables or not.
383+ * @param repairReplicationTable repair replication tables or not.
345384 * @throws SchemaLoaderException thrown when repairing fails.
346385 */
347386 public static void repairAll (
348387 Path configPath ,
349388 String serializedSchemaJson ,
350389 Map <String , String > options ,
351- boolean repairCoordinatorTable )
390+ boolean repairCoordinatorTable ,
391+ boolean repairReplicationTable )
352392 throws SchemaLoaderException {
353393 Either <Path , Properties > config = new Left <>(configPath );
354394 Either <Path , String > schema = new Right <>(serializedSchemaJson );
355- repairAll (config , schema , options , repairCoordinatorTable );
395+ repairAll (config , schema , options , repairCoordinatorTable , repairReplicationTable );
356396 }
357397
358398 /**
@@ -365,14 +405,19 @@ public static void repairAll(
365405 * @param schemaPath path to the schema file.
366406 * @param options specific options for repairing.
367407 * @param repairCoordinatorTable repair coordinator tables or not.
408+ * @param repairReplicationTable repair replication tables or not.
368409 * @throws SchemaLoaderException thrown when repairing fails.
369410 */
370411 public static void repairAll (
371- Path configPath , Path schemaPath , Map <String , String > options , boolean repairCoordinatorTable )
412+ Path configPath ,
413+ Path schemaPath ,
414+ Map <String , String > options ,
415+ boolean repairCoordinatorTable ,
416+ boolean repairReplicationTable )
372417 throws SchemaLoaderException {
373418 Either <Path , Properties > config = new Left <>(configPath );
374419 Either <Path , String > schema = new Left <>(schemaPath );
375- repairAll (config , schema , options , repairCoordinatorTable );
420+ repairAll (config , schema , options , repairCoordinatorTable , repairReplicationTable );
376421 }
377422
378423 /**
@@ -382,13 +427,15 @@ public static void repairAll(
382427 * @param schema schema.
383428 * @param options specific options for repairing.
384429 * @param repairCoordinatorTable repair coordinator tables or not.
430+ * @param repairReplicationTable repair replication tables or not.
385431 * @throws SchemaLoaderException thrown when repairing fails.
386432 */
387433 private static void repairAll (
388434 Either <Path , Properties > config ,
389435 Either <Path , String > schema ,
390436 Map <String , String > options ,
391- boolean repairCoordinatorTable )
437+ boolean repairCoordinatorTable ,
438+ boolean repairReplicationTable )
392439 throws SchemaLoaderException {
393440 // Parse the schema
394441 List <TableSchema > tableSchemaList = getTableSchemaList (schema , options );
@@ -400,6 +447,9 @@ private static void repairAll(
400447 if (repairCoordinatorTable ) {
401448 operator .repairCoordinatorTables (options );
402449 }
450+ if (repairReplicationTable ) {
451+ operator .repairReplicationTables (options );
452+ }
403453 }
404454 }
405455
0 commit comments