Commit e84c6c32 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9d667aec
......@@ -50,8 +50,8 @@
// Conn.atMu > Conn.mu > FileH.mu
//
// Several locks are RWMutex instead of just Mutex not only to allow more
// concurrency, but, in the first place for correctness: pinner being core
// element in handling WCFS isolation protocol, is effectively invoked
// concurrency, but, in the first place for correctness: pinner thread being
// core element in handling WCFS isolation protocol, is effectively invoked
// synchronously from other threads via messages coming through wcfs server.
// For example Conn.resync sends watch request to wcfs and waits for the
// answer. Wcfs server, in turn, sends corresponding pin messages to the pinner
......@@ -66,7 +66,6 @@
// - - - - - -
// client process
//
//
// This creates the neccessity to use RWMutex for locks that pinner and other
// parts of the code could be using at the same time in sychronous mode similar
// to the above. This locks are:
......@@ -139,6 +138,12 @@ pair<Conn, error> WCFS::connect(zodb::Tid at) {
// FIXME ^^^ not right - Conn.open waits for wcfs/head/at only in the end
// and stats head/f to get f.headfsize _before_ that.
// -> just wait here.
// XXX atMu.RLock ?
err = wconn._headWait(at);
if (err != nil) {
// XXX bring conn down - stop pinner
return make_pair(nil, E(err));
}
return make_pair(wconn, nil);
}
......@@ -626,8 +631,20 @@ error _Mapping::unmap() {
// XXX place=? -> closer to pinner & connect
error _Conn::resync(zodb::Tid at) {
_Conn& wconn = *this;
error err;
wconn._atMu.Lock();
xerr::Contextf E("%s: resync -> @%s", v(wconn), v(at));
wconn._atMu.Unlock();
// XXX downErr -> E
// XXX at ^ (increases)
// first wait for wcfs/head to be >= at
err = wconn._headWait(at);
if (err != nil)
return err;
// FIXME first wait for wcfs/head to be >= at
// write-lock wconn._atMu . This excludes everything else, and in
// particular _pinner_, from running and mutating files and mappings.
......@@ -646,10 +663,6 @@ error _Conn::resync(zodb::Tid at) {
wconn._atMu.RUnlock();
});
xerr::Contextf E("%s: resync -> @%s", v(wconn), v(at));
error err;
err = wconn._downErr;
if (err != nil)
return E(err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment