• Kirill Smelkov's avatar
    wcfs: Provide isolation to clients · 6f0cdaff
    Kirill Smelkov authored
    Via custom isolation protocol that both server and clients must cooperatively
    follow. This is the core change that enables file cache to be practically
    shared while each client can still be provided with isolated view of the database.
    
    This patch brings only server changes, tests + the minimum client bits to support the tests.
    The client library, that will implement isolation protocol on client side, will come next.
    
    This patch is organized as follows:
    
    - wcfs.go brings in description of the protocol, overview of how server
      implements that protocol and the implementation itself.
      See also notes.txt
    
    - wcfs_test.py brings in tests for server implementation.
      tWCFS._abort_ontimeout had to be moved into nogil mode into wcfs_test.pyx
      to avoid deadlock on the GIL (see comments in wcfs_test.pyx for details).
    
    - files added in wcfs/client/ are needed to provide client-side
      implementation of WatchLink - the message exchange protocol over
      opened head/watch file - for tests. Client-side watchlink implementation
      lives in wcfs/client/wcfs_watchlink.{h,cpp}. The other additions in
      wcfs/client/ are to support that and to expose the WatchLink to Python.
    
      Client-side bits are done right in C++ because upcoming WCFS client
      library will be implemented in C++ to work in nogil mode in order to
      avoid deadlock on the GIL because client-side pinner thread might be
      woken-up synchronously by WCFS server at any moment, including when
      another client thread already holds the GIL and is paused by WCFS.
    
    Some preliminary history:
    
    9b4a42a3    X invalidation design draftly settled
    27d91d47    X δFtail settled
    c27c1940    X mmap over under pagefault to this mmapping works
    d36b171f    X ptrace when client is under pagefault or syscall won't work
    c1f5bb19    X notes on why lazy-invalidate approach was taken
    4fbdd270    X Proof that that it is possible to change mmapping while under pagefault to it
    33e0dfce    X ΔTail draftly done
    12628943    X make sure "bye" is always processed immediately - even if a handleWatch is currently blocked
    af0a64cb    X test for "bye" canceling blocked handlers
    996dc6a8    X Fix race in test
    43915fe9    X wcfs: Don't forbid simultaneous watch requests
    941dc54b    X wcfs: threading.Lock -> sync.Mutex
    d75b2304    X wcfs: Move _abort_ontimeout to pyx/nogil
    79234659    X Notes on why eagier invalidation was rejected
    f05271b1    X Test that sysread(/head/watch) can be interrupted
    5ba816da    X restore test_wcfs_watch_robust after f05271b1.
    4bd88564    X "Invalidation protocol" -> "Isolation protocol"
    f7b54ca4    X avoid fmt::vsprintf  (now compils again with latest pygolang@master)
    0a8fcd9d    X wcfs/client: Move EOF -> pygolang
    153e02e6    X test_wcfs_watch_setup and test_wcfs_watch_setup_ahead work again
    17f98edc    X wcfs: client: os: Factor syserr -> string into _sysErrString
    7b0c301c    X wcfs: tests: Fix tFile.assertBlk not to segfault on a test failure
    b74dda09    X Start switching Track from Track(key) to Track(keycov)
    8b5d8523    X Move tracking of which blocks were accessed from wcfs to ΔFtail
    6f0cdaff
δbtail.go 41.6 KB