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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
790bee70
Commit
790bee70
authored
Apr 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7476fdac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
wcfs/wcfs.go
wcfs/wcfs.go
+19
-16
No files found.
wcfs/wcfs.go
View file @
790bee70
...
...
@@ -122,7 +122,6 @@
// clients, that had requested it (separately to each client), about the
// changes:
//
// XXX rev_max -> rev?
// S: 2 pin <bigfileX> #<blk> @<rev_max> XXX 2-> 2*k (multiple pins in parallel)
//
// and waits until all clients confirm that changed file block can be updated
...
...
@@ -291,7 +290,7 @@ package main
// cache for @<rev>/bigfile/file[blk], where
//
// # see below about file.δtail
// # XXX -> file.δtail.Last
RevOf
(#blk, zhead.at)
// # XXX -> file.δtail.Last
BlkRev
(#blk, zhead.at)
// rev = max(file.δtail.by(#blk)) || min(rev ∈ file.δtail) || zhead.at
//
// - invalidate head/bigfile/file[blk] in OS file cache.
...
...
@@ -332,14 +331,14 @@ package main
// 7.1) load blkdata for head/bigfile/file[blk] @zhead.at .
//
// while loading this also gives upper bound estimate of when the block
// was last changed:
// was last changed:
XXX kill upper bound -> populate and use δFtail
//
// rev(blk) ≤ max(_.serial for _ in (ZBlk(#blk), all BTree/Bucket that lead to ZBlk))
//
// it is not exact because BTree/Bucket can change (e.g. rebalance)
// but still point to the same k->ZBlk.
//
// we also use file.δtail to find either exact blk revision: XXX
// we also use file.δtail to find either exact blk revision: XXX
just use δFtail
//
// rev(blk) = max(file.δtail.by(#blk) -> []rev↑)
//
...
...
@@ -401,6 +400,13 @@ package main
//
// XXX For every ZODB connection a dedicated read-only transaction is maintained.
// XXX notation
//
// δZ - changes in ZODB space
// δB - changes in BTree*s* space
// δF - changes in File*s* space
// δfile - changes in File(1) space
import
(
"bufio"
"context"
...
...
@@ -670,7 +676,6 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
traceZWatch
(
"zevent: %s"
,
zevent
)
var
zδ
*
zodb
.
EventCommit
switch
zevent
:=
zevent
.
(
type
)
{
default
:
return
fmt
.
Errorf
(
"unexpected event: %T"
,
zevent
)
...
...
@@ -679,15 +684,13 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
return
zevent
.
Err
case
*
zodb
.
EventCommit
:
zδ
=
zevent
root
.
handleδZ
(
zevent
)
}
root
.
zδhandle1
(
zδ
)
}
}
//
zδhandle1
handles 1 change event from ZODB notification.
func
(
root
*
Root
)
zδhandle1
(
zδ
*
zodb
.
EventCommit
)
{
//
handleδZ
handles 1 change event from ZODB notification.
func
(
root
*
Root
)
handleδZ
(
δZ
*
zodb
.
EventCommit
)
{
head
:=
root
.
head
// while we are invalidating OS cache, make sure that nothing, that
...
...
@@ -734,8 +737,8 @@ retry:
//fmt.Printf("\n\n\n")
//
zδ
= (tid↑, []oid)
for
_
,
oid
:=
range
zδ
.
Changev
{
//
δZ
= (tid↑, []oid)
for
_
,
oid
:=
range
δZ
.
Changev
{
// XXX zhead.Cache() lock/unlock
obj
:=
zhead
.
Cache
()
.
Get
(
oid
)
if
obj
==
nil
{
...
...
@@ -796,7 +799,7 @@ retry:
// XXX no indexMu lock needed because head is Locked
// XXX stub -> TODO full δbtree | update indexLooked itself
//fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
δf
:=
bfdir
.
δFtail
.
Update
(
zδ
)
δf
:=
bfdir
.
δFtail
.
Update
(
δZ
)
//fmt.Printf("xfiles: %v\n", xfiles)
for
_
,
δ
:=
range
δf
.
Changev
{
file
:=
δ
.
File
...
...
@@ -847,13 +850,13 @@ retry:
panic
(
err
)
// XXX
}
// resync .zhead to
zδ
.tid
// resync .zhead to
δZ
.tid
// XXX -> Head.Resync() ?
// 1. abort old and resync to new txn/at
transaction
.
Current
(
zhead
.
txnCtx
)
.
Abort
()
_
,
ctx
=
transaction
.
New
(
context
.
Background
())
// XXX bg ok?
err
=
zhead
.
Resync
(
ctx
,
zδ
.
Tid
)
err
=
zhead
.
Resync
(
ctx
,
δZ
.
Tid
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
...
...
@@ -876,7 +879,7 @@ retry:
// notify .wcfs/zhead
for
sk
:=
range
gdebug
.
zheadSockTab
{
_
,
err
:=
fmt
.
Fprintf
(
sk
,
"%s
\n
"
,
zδ
.
Tid
)
_
,
err
:=
fmt
.
Fprintf
(
sk
,
"%s
\n
"
,
δZ
.
Tid
)
if
err
!=
nil
{
log
.
Error
(
err
)
// XXX errctx, -> warning?
sk
.
Close
()
...
...
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