@@ -120,6 +120,9 @@ public DefaultWriter(Time time, ObjectStorage objectStorage, ObjectWALConfig con
120
120
this .nodePrefix = ObjectUtils .nodePrefix (config .clusterId (), config .nodeId (), config .type ());
121
121
this .objectPrefix = nodePrefix + config .epoch () + "/wal/" ;
122
122
this .scheduler = Threads .newSingleThreadScheduledExecutor ("s3-wal-schedule" , true , LOGGER );
123
+ if (!(config .openMode () == OpenMode .READ_WRITE || config .openMode () == OpenMode .FAILOVER )) {
124
+ throw new IllegalArgumentException ("The open mode must be READ_WRITE or FAILOVER, but got " + config .openMode ());
125
+ }
123
126
ObjectWALMetricsManager .setInflightUploadCountSupplier (() -> (long ) uploadingBulks .size ());
124
127
ObjectWALMetricsManager .setBufferedDataInBytesSupplier (bufferedDataBytes ::get );
125
128
ObjectWALMetricsManager .setObjectDataInBytesSupplier (objectDataBytes ::get );
@@ -213,10 +216,6 @@ protected void checkStatus() throws WALFencedException {
213
216
}
214
217
215
218
protected void checkWriteStatus () throws WALFencedException {
216
- if (config .openMode () != OpenMode .READ_WRITE ) {
217
- throw new IllegalStateException ("WAL is in failover mode." );
218
- }
219
-
220
219
checkStatus ();
221
220
}
222
221
@@ -420,7 +419,7 @@ private void callback() {
420
419
// The inflight uploading bulks count was decreased, then trigger the upload of Bulk in waitingUploadBulks
421
420
tryUploadBulkInWaiting ();
422
421
long commitStartTime = time .nanoseconds ();
423
- return reservationService .verify (config .nodeId (), config .epoch (), false )
422
+ return reservationService .verify (config .nodeId (), config .epoch (), config . openMode () == OpenMode . FAILOVER )
424
423
.whenComplete ((rst , ex ) -> {
425
424
ObjectWALMetricsManager .recordOperationLatency (time .nanoseconds () - commitStartTime , "commit" , ex == null );
426
425
if (ex != null ) {
0 commit comments