[WIP] Reinstating early write serialization

This branch lives on a4, I'm handing it off to @JohannesEbke.

Currently, this will cause the tests in a4atlas to fail.

      tests that fail 2/41 
        /data/pwaller/Projects/a4/build/a4atlas/tests/test_a4copy.sh 
    a4copy: (verbose): Starting to process data/salient-realworld.a4
    a4copy: (verbose): Processed 0 events (seen 0 metadata)
    a4copy: (debug): _valid_bytes true
    a4copy: (debug): _valid_bytes decoded..
    a4copy: Warning: Finished but not fully processed (rescheduling): data/salient-realworld.a4
    a4copy: Error (Exception): A4 FATAL ERROR: Merge key is missing in one metadata but present in another
    Backtrace:
    --------------------------------
    GDB: Do you need "set solib-search-path" or "set sysroot"?
    GDB: [New LWP 5983]
    GDB: [Thread debugging using libthread_db enabled]
    GDB: Using host libthread_db library "/lib64/libthread_db.so.1".
    GDB: 0x00007feac0cfe96e in pthread_cond_timedwait () from /lib64/libpthread.so.0
    GDB: 
    GDB: Thread 2 (Thread 0x7feab7dfc700 (LWP 5983)):
    GDB: #0  0x00007feabadb1ebd in read () from /lib64/libc.so.6
    GDB: #1  0x00007feabad4bdd8 in _IO_file_underflow () from /lib64/libc.so.6
    GDB: #2  0x00007feabad4ce2e in _IO_default_uflow () from /lib64/libc.so.6
    GDB: #3  0x00007feabad40cca in _IO_getline_info () from /lib64/libc.so.6
    GDB: #4  0x00007feabad3fa21 in fgets () from /lib64/libc.so.6
    GDB: #5  0x00007feac137edf8 in fgets (__stream=0x7feaa8014120, __n=256, __s=0x7feab7dfb3b0 "Do you need \"set solib-search-path\" or \"set sysroot\"?\n") at /usr/include/bits/stdio2.h:255
    GDB: #6  a4::BackTraceException::BackTraceException (this=0x7feaa8030a40) at ../a4io/src/exceptions.cpp:44
    GDB: #7  0x00007feac139f052 in Fatal<char [60]> (this=0x7feaa8030a40) at /data/pwaller/Projects/a4/a4io/src/a4/exceptions.h:28
    GDB: #8  a4::io::A4Message::check_key_mergable (this=<optimized out>, rhs=..., field_name="run") at ../a4io/src/message.cpp:369
    GDB: #9  0x00007feac1861bdb in new_outgoing_metadata (new_metadata=<error reading variable: access outside bounds of object referenced via synthetic pointer>, this=0x7feaa80008e0) at ../a4process/src/application.cpp:127
    GDB: #10 a4::process::SimpleCommandLineDriver::simple_thread (self=0xa5bf60, p=0xa6b580, limit=-1, stats=..., error=...) at ../a4process/src/application.cpp:282
    GDB: #11 0x00007feabff36b47 in thread_proxy () from /data/pwaller/Projects/a4/miniboost/lib/libboost_thread--a4-mt-1_47.so.1.49.0
    GDB: #12 0x00007feac0cf9da6 in start_thread () from /lib64/libpthread.so.0
    GDB: #13 0x00007feabadbf99d in clone () from /lib64/libc.so.6
    GDB: 
    GDB: Thread 1 (Thread 0x7feac1c52740 (LWP 5959)):
    GDB: #0  0x00007feac0cfe96e in pthread_cond_timedwait () from /lib64/libpthread.so.0
    GDB: #1  0x00007feabff39213 in boost::thread::do_try_join_until(timespec const&) () from /data/pwaller/Projects/a4/miniboost/lib/libboost_thread--a4-mt-1_47.so.1.49.0
    GDB: #2  0x00007feac1865784 in timed_join (abs_time=..., this=<optimized out>) at /data/pwaller/Projects/a4/miniboost/include/boost/thread/detail/thread.hpp:525
    GDB: #3  timed_join<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000l> > (rel_time=..., this=<optimized out>) at /data/pwaller/Projects/a4/miniboost/include/boost/thread/detail/thread.hpp:568
    GDB: #4  a4::process::SimpleCommandLineDriver::main (this=0x7fff5111b0a8, argc=1, argv=0x7fff5111b5c8) at ../a4process/src/application.cpp:502
    GDB: #5  0x000000000040ad6a in a4::process::a4_main_configuration<CopyConfiguration, a4::process::SimpleCommandLineDriver> (argc=4, argv=0x7fff5111b5c8) at /data/pwaller/Projects/a4/a4process/src/a4/application.h:43
    GDB: #6  0x00007feabacf64bd in __libc_start_main () from /lib64/libc.so.6
    GDB: #7  0x0000000000407c19 in _start ()
    GDB: 
    --------------------------------
    A4 FATAL ERROR: Merge key is missing in one metadata but present in another

    Notice: Error has been written to /home/pwaller/.cache/a4/last-fatal-error
    If this is a bug in A4, please submit an issue at https://github.com/JohannesEbke/a4/issues


        /data/pwaller/Projects/a4/build/a4atlas/tests/test_a4reweight.sh 
    a4reweight: (verbose): Starting to process data/salient-realworld.a4
    a4reweight: (verbose): Processed 0 events (seen 0 metadata)
    a4reweight: (debug): _valid_bytes decoded..
    a4: segfault handler called...
    terminate called after throwing an instance of 'a4::Fatal'
      what():  A4 FATAL ERROR: Segmentation Fault!
    Backtrace:
    --------------------------------
    GDB: Do you need "set solib-search-path" or "set sysroot"?
    GDB: [New LWP 6009]
    GDB: [Thread debugging using libthread_db enabled]
    GDB: Using host libthread_db library "/lib64/libthread_db.so.1".
    GDB: 0x00007f649139196e in pthread_cond_timedwait () from /lib64/libpthread.so.0
    GDB: 
    GDB: Thread 2 (Thread 0x7f6487c8e700 (LWP 6009)):
    GDB: #0  0x00007f648b444ebd in read () from /lib64/libc.so.6
    GDB: #1  0x00007f648b3dedd8 in _IO_file_underflow () from /lib64/libc.so.6
    GDB: #2  0x00007f648b3dfe2e in _IO_default_uflow () from /lib64/libc.so.6
    GDB: #3  0x00007f648b3d3cca in _IO_getline_info () from /lib64/libc.so.6
    GDB: #4  0x00007f648b3d2a21 in fgets () from /lib64/libc.so.6
    GDB: #5  0x00007f6491a11df8 in fgets (__stream=0x7f6470020130, __n=256, __s=0x7f6487c8cb80 "Do you need \"set solib-search-path\" or \"set sysroot\"?\n") at /usr/include/bits/stdio2.h:255
    GDB: #6  a4::BackTraceException::BackTraceException (this=0x7f6470042460) at ../a4io/src/exceptions.cpp:44
    GDB: #7  0x00007f6491a146d6 in Fatal<char [20]> (this=0x7f6470042460) at /data/pwaller/Projects/a4/a4io/src/a4/exceptions.h:28
    GDB: #8  a4::Fatal::segfault_handler (i=<optimized out>) at ../a4io/src/exceptions.cpp:179
    GDB: #9  <signal handler called>
    GDB: #10 a4::io::ProtoClassPool::verify_class_id (this=0x0, class_id=4294967295) at ../a4io/src/proto_class_pool.cpp:192
    GDB: #11 0x00007f6491a4866d in a4::io::ProtoClassPool::get_new_message (this=0x0, class_id=<optimized out>) at ../a4io/src/proto_class_pool.cpp:48
    GDB: #12 0x00007f6491a48701 in a4::io::ProtoClassPool::parse_message (this=<optimized out>, class_id=<optimized out>, bytes="") at ../a4io/src/proto_class_pool.cpp:77
    GDB: #13 0x00007f6491a30ae7 in a4::io::A4Message::message (this=0x7f64700009a0) at ../a4io/src/message.cpp:133
    GDB: #14 0x00007f6491a31f97 in a4::io::A4Message::check_key_mergable (this=0x7f64700009a0, rhs=..., field_name="run") at ../a4io/src/message.cpp:362
    GDB: #15 0x00007f6491ef44bd in new_outgoing_metadata (new_metadata=<error reading variable: access outside bounds of object referenced via synthetic pointer>, this=0x7f64700008e0) at ../a4process/src/application.cpp:127
    GDB: #16 a4::process::SimpleCommandLineDriver::simple_thread (self=0xf698c0, p=0xf74d00, limit=-1, stats=..., error=...) at ../a4process/src/application.cpp:280
    GDB: #17 0x00007f64905c9b47 in thread_proxy () from /data/pwaller/Projects/a4/miniboost/lib/libboost_thread--a4-mt-1_47.so.1.49.0
    GDB: #18 0x00007f649138cda6 in start_thread () from /lib64/libpthread.so.0
    GDB: #19 0x00007f648b45299d in clone () from /lib64/libc.so.6
    GDB: 
    GDB: Thread 1 (Thread 0x7f64929b8740 (LWP 6001)):
    GDB: #0  0x00007f649139196e in pthread_cond_timedwait () from /lib64/libpthread.so.0
    GDB: #1  0x00007f64905cc213 in boost::thread::do_try_join_until(timespec const&) () from /data/pwaller/Projects/a4/miniboost/lib/libboost_thread--a4-mt-1_47.so.1.49.0
    GDB: #2  0x00007f6491ef8784 in timed_join (abs_time=..., this=<optimized out>) at /data/pwaller/Projects/a4/miniboost/include/boost/thread/detail/thread.hpp:525
    GDB: #3  timed_join<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000l> > (rel_time=..., this=<optimized out>) at /data/pwaller/Projects/a4/miniboost/include/boost/thread/detail/thread.hpp:568
    GDB: #4  a4::process::SimpleCommandLineDriver::main (this=0x7fff5eba8618, argc=2, argv=0x7fff5eba8b28) at ../a4process/src/application.cpp:502
    GDB: #5  0x000000000040ffa4 in a4::process::a4_main_configuration<A4ReweightConfiguration, a4::process::SimpleCommandLineDriver> (argc=9, argv=0x7fff5eba8b28) at /data/pwaller/Projects/a4/a4process/src/a4/application.h:43
    GDB: #6  0x00007f648b3894bd in __libc_start_main () from /lib64/libc.so.6
    GDB: #7  0x000000000040c1e9 in _start ()
    GDB: 
    --------------------------------
    A4 FATAL ERROR: Segmentation Fault!

    Notice: Error has been written to /home/pwaller/.cache/a4/last-fatal-error
    If this is a bug in A4, please submit an issue at https://github.com/JohannesEbke/a4/issues

    /data/pwaller/Projects/a4/build/a4atlas/tests/test_a4reweight.sh: line 9:  6001 Aborted                 a4reweight --run-number --per run -l 1 -x data/xsdata data/salient-realworld.a4