[Tarantool-patches] [PATCH v3 2/3] test: add a test for wal_cleanup_delay option

Serge Petrenko sergepetrenko at tarantool.org
Wed Mar 24 16:20:50 MSK 2021



23.03.2021 18:47, Cyrill Gorcunov пишет:
> +-- Wait error to appear.
> +test_run:wait_log('master', 'XlogGapError', 1024, 0.1) ~= nil

Thanks for the patch!

You should wait more here. Like, 10 seconds, I think.
Otherwise the test will probably flaky fail on CI.
Most our wait for at most N seconds until condition calls end up with 10 
second timeout (or bigger).

> +
> +--
> +-- Cleanup.
> +test_run:cmd('stop server master')
> +test_run:cmd('stop server replica')
> +test_run:cmd('delete server master')
> +test_run:cmd('delete server replica')
> +
> +--
> +-- Case 2.
> +--
> +-- Lets make sure we're not getting XlogGapError in
> +-- case if wal_cleanup_delay is used the code is almost
> +-- the same as for Case 1 except we don't disable cleanup
> +-- fiber but delay it up to a hour until replica is up
> +-- and running.
> +--
> +
> +test_run:cmd('create server master with script="replication/gh-5806-master.lua"')
> +test_run:cmd('start server master with args="3600", wait=True, wait_load=True')
> +
> +test_run:switch('master')
> +box.schema.user.grant('guest', 'replication')
> +
> +box.cfg{checkpoint_count = 1}
> +
> +engine = test_run:get_cfg('engine')
> +s = box.schema.space.create('test', {engine = engine})
> +_ = s:create_index('pk')
> +
> +test_run:switch('default')
> +test_run:cmd('create server replica with rpl_master=master,\
> +              script="replication/gh-5806-slave.lua"')
> +test_run:cmd('start server replica with wait=True, wait_load=True')
> +
> +test_run:switch('replica')
> +box.cfg{checkpoint_count = 1}
> +s = box.schema.space.create('testreplica')
> +_ = s:create_index('pk')
> +box.space.testreplica:insert({1})
> +box.snapshot()
> +
> +test_run:switch('default')
> +test_run:cmd('stop server replica')
> +
> +test_run:switch('master')
> +box.space.test:insert({1})
> +box.snapshot()
> +
> +test_run:switch('default')
> +test_run:cmd('restart server master with args="3600", wait=True, wait_load=True')
> +test_run:switch('master')
> +box.space.test:insert({2})
> +box.snapshot()
> +assert(box.info.gc().is_paused == true)
> +
> +test_run:switch('default')
> +test_run:cmd('start server replica with wait=True, wait_load=True')
> +
> +--
> +-- Make sure no error happened.
> +assert(test_run:grep_log("master", "XlogGapError") == nil)
> +
> +test_run:cmd('stop server master')
> +test_run:cmd('stop server replica')
> +test_run:cmd('delete server master')
> +test_run:cmd('delete server replica')

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list