apurtell commented on PR #2144:
URL: https://github.com/apache/phoenix/pull/2144#issuecomment-2891825390

   I think the basic test coverage is pretty good now and I will probably take 
this out of draft status today. Let me think if there are a couple more test 
cases that would make sense. 
   
   Here is the test coverage to date:
   
   ## Basic Append and Sync:
   
   `testAppendAndSync()`: Verifies that multiple appends are correctly batched 
and written to the underlying LogFileWriter upon sync(), and that the order of 
operations (appends then sync) is maintained.
   
   ## Failure Handling and Retry (Append/Sync):
   
   `testAppendFailureAndRetry()`: Simulates an append failure on the 
`LogFileWriter`. It checks that the `ReplicationLog` correctly rotates to a new 
writer and retries the append (and subsequent sync) on the new writer.
   
   `testSyncFailureAndRetry()`: Simulates a sync failure on the 
`LogFileWriter`. It verifies that after an append, a failed sync leads to a 
writer rotation, and the original batch (including the failed append) is 
replayed and synced on the new writer.
   
   ## Backpressure (Ring Buffer Full):
   
   `testBlockingWhenRingFull()`: Tests the backpressure mechanism. It simulates 
a slow consumer (inner `LogFileWriter`) to fill the Disruptor ring buffer and 
confirms that subsequent append() calls block until space is available, then 
eventually succeed.
   
   ## Sync Timeout:
   
   `testSyncTimeout()`: Simulates a `LogFileWriter.sync()` operation that takes 
longer than the configured timeout. It verifies that the 
`ReplicationLog.sync()` call throws an `IOException` caused by a 
`TimeoutException`.
   
   ## Concurrent Producers:
   
   `testConcurrentProducers()`: Tests concurrent appends from multiple threads, 
ensuring all records are eventually processed and written by the LogFileWriter 
in the correct order (verified by commitId).
   
   ## Time-Based Rotation:
   
   `testTimeBasedRotation()`: Verifies that the log rotates automatically after 
the configured time interval, even if no new appends trigger a size check.
   
   `testRotationTask()`: Specifically tests the LogRotationTask runnable, 
ensuring it rotates the log when the time threshold is met.
   
   ## Size-Based Rotation:
   
   `testSizeBasedRotation()`: Checks that the log rotates when the current 
writer's file size exceeds the configured size threshold.
   
   ## Close Behavior:
   
   `testClose()`: Ensures that `close()` flushes pending appends, closes the 
underlying writer, and prevents further operations. Also checks for idempotency 
of `close()`.
   
   ## Error Handling during Rotation/Initialization:
   
   `testFailedRotation()`: Simulates a failure during the creation of a new 
writer during rotation. It verifies that the ReplicationLog continues to use 
the old writer for subsequent appends and syncs, rather than failing completely.
   
   `testEventProcessingException()`: Simulates a RuntimeException during the 
LogEventHandler's processing of an append event. It verifies that the 
`LogExceptionHandler` catches this, closes the ReplicationLog (and its writer), 
and subsequent operations fail.
   
   `testSyncFailureAllRetriesExhausted()`: Simulates persistent sync failures 
across multiple retries (and rotations). It verifies that the sync operation 
eventually fails with a timeout after exhausting retries.
   
   `testFsInitFailure()`: Simulates a failure during FileSystem.mkdirs() when 
initializing the ReplicationLog. Verifies that `init()` throws an `IOException`.
   
   ## Rotation During Batch:
   
   `testRotationDuringBatch()`: Tests the scenario where a rotation occurs 
while a batch of appends is in-flight (i.e., published to the ring buffer but 
not yet processed by the event handler). It verifies that the in-flight batch 
is correctly replayed to the new writer after rotation.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to