summaryrefslogtreecommitdiff
path: root/tests/integration/aof.tcl
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2019-08-19 12:18:25 +0300
committerYossi Gottlieb <yossigo@gmail.com>2019-10-07 21:06:30 +0300
commit6b6294807c0bca50041da117c1abb35f5114e972 (patch)
treee13c13d22cab5b36d1ad70c73d4398d30dd6eb15 /tests/integration/aof.tcl
parent5a477946065bcf05b335ededd6b794e82882ab73 (diff)
downloadredis-6b6294807c0bca50041da117c1abb35f5114e972.tar.gz
TLS: Implement support for write barrier.
Diffstat (limited to 'tests/integration/aof.tcl')
-rw-r--r--tests/integration/aof.tcl31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl
index e276a6254..2734de7f1 100644
--- a/tests/integration/aof.tcl
+++ b/tests/integration/aof.tcl
@@ -257,4 +257,35 @@ tags {"aof"} {
r expire x -1
}
}
+
+ start_server {overrides {appendonly {yes} appendfilename {appendonly.aof} appendfsync always}} {
+ test {AOF fsync always barrier issue} {
+ set rd [redis_deferring_client]
+ # Set a sleep when aof is flushed, so that we have a chance to look
+ # at the aof size and detect if the response of an incr command
+ # arrives before the data was written (and hopefully fsynced)
+ # We create a big reply, which will hopefully not have room in the
+ # socket buffers, and will install a write handler, then we sleep
+ # a big and issue the incr command, hoping that the last portion of
+ # the output buffer write, and the processing of the incr will happen
+ # in the same event loop cycle.
+ # Since the socket buffers and timing are unpredictable, we fuzz this
+ # test with slightly different sizes and sleeps a few times.
+ for {set i 0} {$i < 10} {incr i} {
+ r debug aof-flush-sleep 0
+ r del x
+ r setrange x [expr {int(rand()*5000000)+10000000}] x
+ r debug aof-flush-sleep 500000
+ set aof [file join [lindex [r config get dir] 1] appendonly.aof]
+ set size1 [file size $aof]
+ $rd get x
+ after [expr {int(rand()*30)}]
+ $rd incr new_value
+ $rd read
+ $rd read
+ set size2 [file size $aof]
+ assert {$size1 != $size2}
+ }
+ }
+ }
}