Commit 7a96c026 authored by Bernd Lietzow's avatar Bernd Lietzow 🐨

meta/testing: add test for modsync early abort

test that the modsync does actually stop when an error occurs

note: passing the environment variable to trigger the modsync failure
will only work after 7920e5a11d652fa661ce7ff8d8e232594efb477b has been
merged to fix the test runner.
parent bfde6914
......@@ -3,6 +3,7 @@
#include <common/net/message/storage/mirroring/ResyncRawInodesRespMsg.h>
#include <common/toolkit/StringTk.h>
#include <common/toolkit/MessagingTk.h>
#include <common/toolkit/DebugVariable.h>
#include <common/Common.h>
#include <net/message/storage/mirroring/ResyncRawInodesMsgEx.h>
......@@ -61,6 +62,8 @@ bool resyncElemCmp(const MetaSyncCandidateFile::Element& a, const MetaSyncCandid
FhgfsOpsErr BuddyResyncerModSyncSlave::streamCandidates(Socket& socket)
{
DEBUG_ENV_VAR(unsigned, DEBUG_FAIL_MODSYNC, 0, "BEEGFS_DEBUG_FAIL_MODSYNC");
while (!getSelfTerminateNotIdle())
{
if (syncCandidates->isFilesEmpty())
......@@ -110,7 +113,7 @@ FhgfsOpsErr BuddyResyncerModSyncSlave::streamCandidates(Socket& socket)
return FhgfsOpsErr_INTERNAL;
}
if (resyncRes != FhgfsOpsErr_SUCCESS)
if (resyncRes != FhgfsOpsErr_SUCCESS || DEBUG_FAIL_MODSYNC)
{
LOG(ERR, "Modification resync failed.", element.path, element.isDeletion, resyncRes);
numErrors.increase();
......
mount = node.properties["client0"]["mount"]
# how long shall the test wait for the resync to start and fail?
timeout = 60
done = false
on node do; cd mount do
shell "for i in `seq 1 10000`; do touch file_$i; done"
end; end
parallel do
on node do; cd mount do
t1 = Time.now
while Time.now < t1 + timeout and not done do
shell "touch file_1"
sleep 0.1
end
end; end
on node do; cd mount do
shell "sudo #{$binaries[:ctl]} --startresync --nodetype=meta --mirrorgroupid=101"
begin
shell "sudo #{$binaries[:ctl]} --startresync --nodetype=meta --mirrorgroupid=101"
wait_daemon_log(node, "meta0", "Modification resync failed.", timeout)
done = true
# wait a moment to make sure the --resyncstats has been updated
sleep 10
# check if resync has actually stopped
raise if not shell? "sudo #{$binaries[:ctl]} --resyncstats --nodetype=meta \
--mirrorgroupid=101 | grep -i \"completed with errors\""
# modsync should fail immediately, so 0 objects synced, 1 error
raise if not shell? "sudo #{$binaries[:ctl]} --resyncstats --nodetype=meta \
--mirrorgroupid=101 | grep -i \"modification objects synced: 0\""
raise if not shell? "sudo #{$binaries[:ctl]} --resyncstats --nodetype=meta \
--mirrorgroupid=101 | grep -i \"modification sync errors: 1\""
rescue
raise "Modification resync was expected to fail and abort immediately but didn't."
end
end; end
end
hosts:
node:
- env:
BEEGFS_DEBUG_FAIL_MODSYNC: 1
- mgmtd
- meta:
id: 1
- meta:
id: 2
- storage:
id: 3
- helperd
- client
mirroring:
meta_groups:
- id: 101
primary: 1
secondary: 2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment