smiklosovic commented on code in PR #4276:
URL: https://github.com/apache/cassandra/pull/4276#discussion_r2239560217


##########
test/unit/org/apache/cassandra/db/commitlog/CommitLogReaderTest.java:
##########
@@ -165,6 +182,59 @@ public void testReadCountFromMidpoint() throws Throwable
         confirmReadOrder(testHandler, samples / 2);
     }
 
+    @Test
+    public void testSyncMarkerChecksumReadFailed_ignoreReplayErrorsDisabled() 
throws Throwable
+    {
+        
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.stop);
+
+        File corruptedSegmentFile = createAndWriteCorruptedCommitLogFile();
+        CommitLogReader reader = new CommitLogReader();
+        // use real CLR handler to test actual behavior
+        CommitLogReadHandler clrHandler =
+                new CommitLogReplayer(new CommitLog(null), null, null, null);
+
+        // ignore.replay.errors disabled, so we expect the exception here
+        Assertions.assertThatThrownBy(() ->
+                                      reader.readCommitLogSegment(clrHandler,
+                                                                  
corruptedSegmentFile,
+                                                                  
CommitLogPosition.NONE,
+                                                                  
CommitLogReader.ALL_MUTATIONS,
+                                                                  false)
+                  
).isInstanceOf(CommitLogReplayer.CommitLogReplayException.class);
+    }
+
+    @Test
+    public void testSyncMarkerChecksumReadFailed_ignoreReplayErrorsEnabled() 
throws Throwable
+    {
+        System.setProperty(IGNORE_REPLAY_ERRORS_PROPERTY, "true");

Review Comment:
   The test passes as well when this is commented out.
   
   I would do
   
   ````
       @Test
       public void testSyncMarkerChecksumReadFailed_ignoreReplayErrorsEnabled() 
throws Throwable
       {
           try (WithProperties properties = new 
WithProperties(IGNORE_REPLAY_ERRORS_PROPERTY, "true"))
           {
               
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.stop);
   ...
   ````
   
   and remove whole `@After`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to