Writethrough of bio requests having more than one biovec should
only sync the last one. The others will be written to the transaction
log anyway. No need to wait for each of them to be committed one
by one.
Previously, the 'marsadm primary' and 'marsadm secondary' commands
were successful as soon as the target primary was successfully set
to the new primary or '(none)', respectively. This commit appends
a check to wait until the primary is really changed (actual state).
Changes in marsadm:
- Added check_primary_settled() function
- Do not use local variable named '$host' in _primary_res() since
a global variable with same name exists.
- Do not use/set global variable '$host' in primary_res(). Use
local variable '$new' initially set to '$host' instead.
- Make 'secondary' command idempotent ("is already secondary")
- Call trigger() and check_primary_settled() in primary_res()
Related minor changes:
- marsadm: Added optional parameter 'sleeptime' to sleep_timeout()
- Removed debug output in check_file_aged()
Signed-off-by: Thomas Schoebel-Theuer <tst@1und1.de>
It appears that concurrent reads and writes on AIO seem to
result in inconsistent reads in some very rare cases, due to
races. Sometimes, the inode claims that the file has been already
appended by a write operation, but the data has not actually hit
the page cache, such that a concurrent read gets NULL blocks.
This is a workaround by "misusing" the mapfree infrastructure.
It depends on uniqueness of file names, which is not the right thing
to do.
Best fix would be in the kernel.
The actual primary is decoded in 'actual-*/is-primary' links, while the
target primary is decoded in the 'primary' link. This is not clearly
taken into account in several functions of marsadm. This commit fixes
this problem.
- Added _get_actual_primary() function
- Remove $pri parameter in _primary_res
- Use _get_actual_primary() where actual state should be used
Commits 3e96a5e 578d003 5dccbdc rebased to dfeb8e6
Signed-off-by: Thomas Schoebel-Theuer <tst@1und1.de>
- Added mars_time() function returning lamport clock
- Renamed check_mtime to check_file_aged and fixed to use mars_time()
- Renamed check_all_mtimes to check_files_modified_any_of
Commits eb849e2 1be8700 fbb415a rebased on dfeb8e6
Signed-off-by: Thomas Schoebel-Theuer <tst@1und1.de>