Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
4bd88564
Commit
4bd88564
authored
Jan 15, 2020
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X "Invalidation protocol" -> "Isolation protocol"
parent
3347d835
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
27 deletions
+29
-27
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+1
-1
wcfs/internal/wcfs_watchlink.h
wcfs/internal/wcfs_watchlink.h
+2
-2
wcfs/todo.dot
wcfs/todo.dot
+1
-1
wcfs/todo.svg
wcfs/todo.svg
+6
-6
wcfs/wcfs.go
wcfs/wcfs.go
+17
-15
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+2
-2
No files found.
wcfs/internal/wcfs_watchlink.cpp
View file @
4bd88564
...
@@ -361,7 +361,7 @@ error _WatchLink::recvReq(context::Context ctx, PinReq *prx) {
...
@@ -361,7 +361,7 @@ error _WatchLink::recvReq(context::Context ctx, PinReq *prx) {
return
E
(
_parsePinReq
(
prx
,
&
pkt
));
return
E
(
_parsePinReq
(
prx
,
&
pkt
));
}
}
// _parsePinReq parses message into PinReq according to wcfs i
nvalid
ation protocol.
// _parsePinReq parses message into PinReq according to wcfs i
sol
ation protocol.
static
error
_parsePinReq
(
PinReq
*
pin
,
const
rxPkt
*
pkt
)
{
static
error
_parsePinReq
(
PinReq
*
pin
,
const
rxPkt
*
pkt
)
{
//printf("parse pinreq: stream=%lu msg='%s'\n", pkt->stream, &pkt->data[0]);
//printf("parse pinreq: stream=%lu msg='%s'\n", pkt->stream, &pkt->data[0]);
pin
->
stream
=
pkt
->
stream
;
pin
->
stream
=
pkt
->
stream
;
...
...
wcfs/internal/wcfs_watchlink.h
View file @
4bd88564
...
@@ -65,7 +65,7 @@ static_assert(sizeof(rxPkt) == 256, "rxPkt miscompiled"); // NOTE 128 is too l
...
@@ -65,7 +65,7 @@ static_assert(sizeof(rxPkt) == 256, "rxPkt miscompiled"); // NOTE 128 is too l
//
//
// It is created by WCFS::_openwatch().
// It is created by WCFS::_openwatch().
//
//
// .sendReq()/.recvReq() provides raw IO in terms of wcfs i
nvalid
ation protocol messages.
// .sendReq()/.recvReq() provides raw IO in terms of wcfs i
sol
ation protocol messages.
// .close() closes the link.
// .close() closes the link.
//
//
// It is safe to use WatchLink from multiple threads simultaneously.
// It is safe to use WatchLink from multiple threads simultaneously.
...
@@ -75,7 +75,7 @@ class _WatchLink : public object {
...
@@ -75,7 +75,7 @@ class _WatchLink : public object {
os
::
File
_f
;
// head/watch file handle
os
::
File
_f
;
// head/watch file handle
string
_rxbuf
;
// buffer for read data from _f
string
_rxbuf
;
// buffer for read data from _f
// i
nv
.protocol message IO
// i
so
.protocol message IO
chan
<
rxPkt
>
_acceptq
;
// server originated messages go here
chan
<
rxPkt
>
_acceptq
;
// server originated messages go here
sync
::
Mutex
_rxmu
;
sync
::
Mutex
_rxmu
;
bool
_rxdown
;
bool
_rxdown
;
...
...
wcfs/todo.dot
View file @
4bd88564
...
@@ -4,7 +4,7 @@ digraph {
...
@@ -4,7 +4,7 @@ digraph {
ordering
=
in
;
ordering
=
in
;
wcfs
[
label
=
"wcfs"
]
wcfs
[
label
=
"wcfs"
]
invProto
[
label
=
"open/i
nvalid
ation\nprotocol"
,
style
=
filled
fillcolor
=
grey95
]
invProto
[
label
=
"open/i
sol
ation\nprotocol"
,
style
=
filled
fillcolor
=
grey95
]
client
[
label
=
"client"
,
style
=
filled
fillcolor
=
grey97
]
client
[
label
=
"client"
,
style
=
filled
fillcolor
=
grey97
]
wcfs
->
invProto
;
wcfs
->
invProto
;
...
...
wcfs/todo.svg
View file @
4bd88564
...
@@ -18,15 +18,15 @@
...
@@ -18,15 +18,15 @@
<!-- invProto -->
<!-- invProto -->
<g
id=
"node2"
class=
"node"
>
<g
id=
"node2"
class=
"node"
>
<title>
invProto
</title>
<title>
invProto
</title>
<ellipse
fill=
"#f2f2f2"
stroke=
"#000000"
cx=
"1070.2046"
cy=
"-389.3036"
rx=
"
78.477
7"
ry=
"26.7407"
/>
<ellipse
fill=
"#f2f2f2"
stroke=
"#000000"
cx=
"1070.2046"
cy=
"-389.3036"
rx=
"
65.522
7"
ry=
"26.7407"
/>
<text
text-anchor=
"middle"
x=
"1070.2046"
y=
"-393.1036"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
open/i
nvalid
ation
</text>
<text
text-anchor=
"middle"
x=
"1070.2046"
y=
"-393.1036"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
open/i
sol
ation
</text>
<text
text-anchor=
"middle"
x=
"1070.2046"
y=
"-378.1036"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
protocol
</text>
<text
text-anchor=
"middle"
x=
"1070.2046"
y=
"-378.1036"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
protocol
</text>
</g>
</g>
<!-- wcfs->invProto -->
<!-- wcfs->invProto -->
<g
id=
"edge1"
class=
"edge"
>
<g
id=
"edge1"
class=
"edge"
>
<title>
wcfs
->
invProto
</title>
<title>
wcfs
->
invProto
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M902.6265,-389.3036C9
28.9401,-389.3036 955.2537,-389.3036 981.5674
,-389.3036"
/>
<path
fill=
"none"
stroke=
"#000000"
d=
"M902.6265,-389.3036C9
33.1106,-389.3036 963.5948,-389.3036 994.079
,-389.3036"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"9
81.6524,-392.8037 991.6523,-389.3036 981.6523,-385.8037 981.6524
,-392.8037"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"9
94.4171,-392.8037 1004.4171,-389.3036 994.417,-385.8037 994.4171
,-392.8037"
/>
</g>
</g>
<!-- liveCacheControl -->
<!-- liveCacheControl -->
<g
id=
"node4"
class=
"node"
>
<g
id=
"node4"
class=
"node"
>
...
@@ -101,8 +101,8 @@
...
@@ -101,8 +101,8 @@
<!-- invProto->client -->
<!-- invProto->client -->
<g
id=
"edge2"
class=
"edge"
>
<g
id=
"edge2"
class=
"edge"
>
<title>
invProto
->
client
</title>
<title>
invProto
->
client
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M11
59.0843,-389.3036C1179.5479,-389.3036 1200.0114,-389.3036 1220.475
,-389.3036"
/>
<path
fill=
"none"
stroke=
"#000000"
d=
"M11
46.4748,-389.3036C1171.0624,-389.3036 1195.6499,-389.3036 1220.2374
,-389.3036"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"11
59.0386,-385.8037 1149.0386,-389.3036 1159.0385,-392.8037 1159.0386
,-385.8037"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"11
46.312,-385.8037 1136.312,-389.3036 1146.312,-392.8037 1146.312
,-385.8037"
/>
</g>
</g>
<!-- client->wcfsRead -->
<!-- client->wcfsRead -->
<g
id=
"edge25"
class=
"edge"
>
<g
id=
"edge25"
class=
"edge"
>
...
...
wcfs/wcfs.go
View file @
4bd88564
...
@@ -31,12 +31,14 @@
...
@@ -31,12 +31,14 @@
// head/bigfile/<bigfileX> which represents always latest bigfile data.
// head/bigfile/<bigfileX> which represents always latest bigfile data.
// Clients that want to get isolation guarantee should subscribe for
// Clients that want to get isolation guarantee should subscribe for
// invalidations and re-mmap invalidated regions to file with pinned bigfile revision for
// invalidations and re-mmap invalidated regions to file with pinned bigfile revision for
// the duration of their transaction. See "I
nvalid
ation protocol" for details.
// the duration of their transaction. See "I
sol
ation protocol" for details.
//
//
// In the usual situation when bigfiles are big, and there are O(1)/δt updates,
// In the usual situation when bigfiles are big, and there are O(1)/δt updates,
// there should be no need for any cache besides shared kernel cache of latest
// there should be no need for any cache besides shared kernel cache of latest
// bigfile data.
// bigfile data.
//
//
// XXX reference to wcfs client library.
//
//
//
// Filesystem organization
// Filesystem organization
//
//
...
@@ -68,7 +70,7 @@
...
@@ -68,7 +70,7 @@
// /at describes precisely ZODB state for which bigfile data is currently
// /at describes precisely ZODB state for which bigfile data is currently
// exposed. Whenever bigfile data is changed in upstream ZODB, information
// exposed. Whenever bigfile data is changed in upstream ZODB, information
// about the changes is first propagated to /watch, and only after that
// about the changes is first propagated to /watch, and only after that
// /bigfile/<bigfileX> is updated. See "I
nvalid
ation protocol" for details.
// /bigfile/<bigfileX> is updated. See "I
sol
ation protocol" for details.
//
//
// @<revX>/ has the following structure:
// @<revX>/ has the following structure:
//
//
...
@@ -85,9 +87,9 @@
...
@@ -85,9 +87,9 @@
// wcfs filesystem. Similarly @<revX>/ become visible only after access.
// wcfs filesystem. Similarly @<revX>/ become visible only after access.
//
//
//
//
// I
nvalidation protocol XXX -> "Isolation protocol"
// I
solation protocol
//
//
// In order to support isolation, wcfs implements i
nvalid
ation protocol that
// In order to support isolation, wcfs implements i
sol
ation protocol that
// must be cooperatively followed by both wcfs and client.
// must be cooperatively followed by both wcfs and client.
//
//
// First, client mmaps latest bigfile, but does not access it
// First, client mmaps latest bigfile, but does not access it
...
@@ -125,9 +127,7 @@
...
@@ -125,9 +127,7 @@
// head/watch links to clients, that had requested it (separately to each
// head/watch links to clients, that had requested it (separately to each
// client), about the changes:
// client), about the changes:
//
//
// S: <2·k> pin <bigfileX> #<blk> @<rev_max>
// S: <2·k> pin <bigfileX> #<blk> @<rev_max> ; @head means unpin
// XXX @head means unpin.
// XXX -> use `unpin <bigfileX> #<blk>`
//
//
// and waits until all clients confirm that changed file block can be updated
// and waits until all clients confirm that changed file block can be updated
// in global OS cache.
// in global OS cache.
...
@@ -137,7 +137,9 @@
...
@@ -137,7 +137,9 @@
// # mmapped at address corresponding to #blk
// # mmapped at address corresponding to #blk
// mmap(@<rev_max>/bigfile/<bigfileX>, #blk, MAP_FIXED)
// mmap(@<rev_max>/bigfile/<bigfileX>, #blk, MAP_FIXED)
//
//
// XXX unpin -> mmap(head/bigfile/<bigfileX>, #blk, MAP_FIXED)
// or, if given @head as @<rev_max>, to bigfile@head
//
// mmap(head/bigfile/<bigfileX>, #blk, MAP_FIXED)
//
//
// and must send ack back to the server when it is done:
// and must send ack back to the server when it is done:
//
//
...
@@ -185,7 +187,7 @@
...
@@ -185,7 +187,7 @@
//
//
// The problem could be avoided, if wcfs would reside inside OS kernel and this
// The problem could be avoided, if wcfs would reside inside OS kernel and this
// way could be able to manipulate clients address space directly (then
// way could be able to manipulate clients address space directly (then
// i
nvalid
ation protocol won't be needed). It is also possible to imagine
// i
sol
ation protocol won't be needed). It is also possible to imagine
// mechanism, where wcfs would synchronously change clients' address space via
// mechanism, where wcfs would synchronously change clients' address space via
// injecting trusted code and running it on client side via ptrace to adjust
// injecting trusted code and running it on client side via ptrace to adjust
// file mappings.
// file mappings.
...
@@ -379,7 +381,7 @@ package main
...
@@ -379,7 +381,7 @@ package main
//
//
// watch.pin(file, #blk, @rev)
// watch.pin(file, #blk, @rev)
//
//
// sends pin message according to "I
nvalid
ation protocol", and is assumed
// sends pin message according to "I
sol
ation protocol", and is assumed
// to cause
// to cause
//
//
// remmap(file, #blk, @rev/bigfile/file)
// remmap(file, #blk, @rev/bigfile/file)
...
@@ -669,7 +671,7 @@ type Watch struct {
...
@@ -669,7 +671,7 @@ type Watch struct {
// atMu, similarly to zheadMu, protects watch.at and pins associated with Watch.
// atMu, similarly to zheadMu, protects watch.at and pins associated with Watch.
// atMu.R guarantees that watch.at is not changing, but multiple
// atMu.R guarantees that watch.at is not changing, but multiple
// simultaneous pins could be running (used e.g. by readPinWatchers).
// simultaneous pins could be running (used e.g. by readPinWatchers).
// atMu.W guaran
e
ees that only one user has watch.at write access and
// atMu.W guaran
t
ees that only one user has watch.at write access and
// that no pins are running (used by setupWatch).
// that no pins are running (used by setupWatch).
atMu
sync
.
RWMutex
atMu
sync
.
RWMutex
at
zodb
.
Tid
// requested to be watched @at
at
zodb
.
Tid
// requested to be watched @at
...
@@ -1324,7 +1326,7 @@ retry:
...
@@ -1324,7 +1326,7 @@ retry:
log
.
Errorf
(
"BUG: bigfile %s: blk %d: -> pagecache: %s (ignoring, but reading from bigfile will be very slow)"
,
oid
,
blk
,
st
)
log
.
Errorf
(
"BUG: bigfile %s: blk %d: -> pagecache: %s (ignoring, but reading from bigfile will be very slow)"
,
oid
,
blk
,
st
)
}
}
// -------- i
nvalid
ation protocol notification/serving --------
// -------- i
sol
ation protocol notification/serving --------
//
//
// (see "7.2) for all registered client@at watchers ...")
// (see "7.2) for all registered client@at watchers ...")
...
@@ -1554,7 +1556,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
...
@@ -1554,7 +1556,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
bfdir
.
fileMu
.
Unlock
()
bfdir
.
fileMu
.
Unlock
()
if
f
==
nil
{
if
f
==
nil
{
wlink
.
byfileMu
.
Unlock
()
wlink
.
byfileMu
.
Unlock
()
// by "i
nvalid
ation protocol" watch is setup after data file was opened
// by "i
sol
ation protocol" watch is setup after data file was opened
return
fmt
.
Errorf
(
"file not yet known to wcfs or is not a ZBigFile"
)
return
fmt
.
Errorf
(
"file not yet known to wcfs or is not a ZBigFile"
)
}
}
...
@@ -1671,7 +1673,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
...
@@ -1671,7 +1673,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// downgrade atMu.W -> atMu.R to let other clients to access the file.
// downgrade atMu.W -> atMu.R to let other clients to access the file.
// XXX there is no primitive to do Wlock->Rlock atomically, but we are
// XXX there is no primitive to do Wlock->Rlock atomically, but we are
// ok with that since we prepared eve
yr
hing to handle simultaneous pins
// ok with that since we prepared eve
ryt
hing to handle simultaneous pins
// from other reads.
// from other reads.
w
.
atMu
.
Unlock
()
w
.
atMu
.
Unlock
()
w
.
atMu
.
RLock
()
w
.
atMu
.
RLock
()
...
@@ -1832,7 +1834,7 @@ func (wlink *WatchLink) _serve() (err error) {
...
@@ -1832,7 +1834,7 @@ func (wlink *WatchLink) _serve() (err error) {
// client-initiated request
// client-initiated request
// bye TODO document in "I
nvalid
ation protocol"
// bye TODO document in "I
sol
ation protocol"
if
msg
==
"bye"
{
if
msg
==
"bye"
{
return
nil
// deferred sk.Close will wake-up rx on client side
return
nil
// deferred sk.Close will wake-up rx on client side
}
}
...
...
wcfs/wcfs_test.py
View file @
4bd88564
...
@@ -1030,7 +1030,7 @@ def _blkRevAt(t, zf, blk, at): # -> rev
...
@@ -1030,7 +1030,7 @@ def _blkRevAt(t, zf, blk, at): # -> rev
# _pinnedAt returns which blocks needs to be pinned for zf@at compared to zf@head
# _pinnedAt returns which blocks needs to be pinned for zf@at compared to zf@head
# according to wcfs i
nvalid
ation protocol.
# according to wcfs i
sol
ation protocol.
#
#
# Criteria for when blk must be pinned as of @at view:
# Criteria for when blk must be pinned as of @at view:
#
#
...
@@ -1073,7 +1073,7 @@ def iter_revv(t, start=z64, level=0):
...
@@ -1073,7 +1073,7 @@ def iter_revv(t, start=z64, level=0):
# -------------------------------------
# -------------------------------------
# ---- actual tests to access data ----
# ---- actual tests to access data ----
# exercise wcfs functionality without wcfs i
nvalid
ation protocol.
# exercise wcfs functionality without wcfs i
sol
ation protocol.
# plain data access + wcfs handling of ZODB invalidations.
# plain data access + wcfs handling of ZODB invalidations.
@
func
@
func
def
test_wcfs_basic
():
def
test_wcfs_basic
():
...
...
Kirill Smelkov
@kirr
mentioned in commit
6f0cdaff
·
Oct 28, 2021
mentioned in commit
6f0cdaff
mentioned in commit 6f0cdaff23d4f8c3384b74b02d669c7fcfc2d821
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment