File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
main/java/com/scalar/dl/ledger/config
test/java/com/scalar/dl/ledger/config Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -519,6 +519,14 @@ private void validateTransactionManager() {
519519 LedgerError .CONFIG_GROUP_COMMIT_MUST_BE_DISABLED .buildMessage (
520520 ConsensusCommitConfig .COORDINATOR_GROUP_COMMIT_ENABLED ));
521521 }
522+ if (consensusCommitConfig .isCoordinatorWriteOmissionOnReadOnlyEnabled ()) {
523+ LOGGER .warn (
524+ "Disabling the unsupported option '{}' because Coordinator writes are always necessary for ScalarDL" ,
525+ ConsensusCommitConfig .COORDINATOR_WRITE_OMISSION_ON_READ_ONLY_ENABLED );
526+ props .setProperty (
527+ ConsensusCommitConfig .COORDINATOR_WRITE_OMISSION_ON_READ_ONLY_ENABLED ,
528+ Boolean .toString (false ));
529+ }
522530 }
523531 }
524532
Original file line number Diff line number Diff line change @@ -581,4 +581,38 @@ public void constructor_HmacEnabledButCipherKeyNotGiven_ShouldThrowIllegalArgume
581581 // Assert
582582 assertThat (thrown ).isExactlyInstanceOf (IllegalArgumentException .class );
583583 }
584+
585+ @ Test
586+ public void
587+ constructor_ConsensusCommitWithCoordinatorWriteOmissionDisabledSpecified_ShouldConstructProperly () {
588+ // Arrange
589+ props .setProperty (DatabaseConfig .TRANSACTION_MANAGER , "consensus-commit" );
590+ props .setProperty (
591+ ConsensusCommitConfig .COORDINATOR_WRITE_OMISSION_ON_READ_ONLY_ENABLED , "false" );
592+
593+ // Act
594+ LedgerConfig config = new LedgerConfig (props );
595+ ConsensusCommitConfig consensusCommitConfig =
596+ new ConsensusCommitConfig (config .getDatabaseConfig ());
597+
598+ // Assert
599+ assertThat (consensusCommitConfig .isCoordinatorWriteOmissionOnReadOnlyEnabled ()).isFalse ();
600+ }
601+
602+ @ Test
603+ public void
604+ constructor_ConsensusCommitWithCoordinatorWriteOmissionEnabledSpecified_ShouldConstructProperlyWithDisablingIt () {
605+ // Arrange
606+ props .setProperty (DatabaseConfig .TRANSACTION_MANAGER , "consensus-commit" );
607+ props .setProperty (
608+ ConsensusCommitConfig .COORDINATOR_WRITE_OMISSION_ON_READ_ONLY_ENABLED , "true" );
609+
610+ // Act
611+ LedgerConfig config = new LedgerConfig (props );
612+ ConsensusCommitConfig consensusCommitConfig =
613+ new ConsensusCommitConfig (config .getDatabaseConfig ());
614+
615+ // Assert
616+ assertThat (consensusCommitConfig .isCoordinatorWriteOmissionOnReadOnlyEnabled ()).isFalse ();
617+ }
584618}
You can’t perform that action at this time.
0 commit comments