Issue #1404. WAL tests and performance improvement.
Merge remote-tracking branch 'origin/master'