• 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:
    
    kirr/wendelin.core@9b4a42a3    X invalidation design draftly settled
    kirr/wendelin.core@27d91d47    X δFtail settled
    kirr/wendelin.core@c27c1940    X mmap over under pagefault to this mmapping works
    kirr/wendelin.core@d36b171f    X ptrace when client is under pagefault or syscall won't work
    kirr/wendelin.core@c1f5bb19    X notes on why lazy-invalidate approach was taken
    kirr/wendelin.core@4fbdd270    X Proof that that it is possible to change mmapping while under pagefault to it
    kirr/wendelin.core@33e0dfce    X ΔTail draftly done
    kirr/wendelin.core@12628943    X make sure "bye" is always processed immediately - even if a handleWatch is currently blocked
    kirr/wendelin.core@af0a64cb    X test for "bye" canceling blocked handlers
    kirr/wendelin.core@996dc6a8    X Fix race in test
    kirr/wendelin.core@43915fe9    X wcfs: Don't forbid simultaneous watch requests
    kirr/wendelin.core@941dc54b    X wcfs: threading.Lock -> sync.Mutex
    kirr/wendelin.core@d75b2304    X wcfs: Move _abort_ontimeout to pyx/nogil
    kirr/wendelin.core@79234659    X Notes on why eagier invalidation was rejected
    kirr/wendelin.core@f05271b1    X Test that sysread(/head/watch) can be interrupted
    kirr/wendelin.core@5ba816da    X restore test_wcfs_watch_robust after f05271b1.
    kirr/wendelin.core@4bd88564    X "Invalidation protocol" -> "Isolation protocol"
    kirr/wendelin.core@f7b54ca4    X avoid fmt::vsprintf  (now compils again with latest pygolang@master)
    kirr/wendelin.core@0a8fcd9d    X wcfs/client: Move EOF -> pygolang
    kirr/wendelin.core@153e02e6    X test_wcfs_watch_setup and test_wcfs_watch_setup_ahead work again
    kirr/wendelin.core@17f98edc    X wcfs: client: os: Factor syserr -> string into _sysErrString
    kirr/wendelin.core@7b0c301c    X wcfs: tests: Fix tFile.assertBlk not to segfault on a test failure
    kirr/wendelin.core@b74dda09    X Start switching Track from Track(key) to Track(keycov)
    kirr/wendelin.core@8b5d8523    X Move tracking of which blocks were accessed from wcfs to ΔFtail
    6f0cdaff
test_virtmem.c 36.7 KB