forked from flaxsearch/luwak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PURGE-NOTES
68 lines (44 loc) · 1.76 KB
/
PURGE-NOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
indexer thread purge thread
clone tlog
add docs <-- dropped!
collect
commit
clear tlog
swap tlog
-----------------------------------------
* add docs + commit is guarded by a read lock
* purge thread creates purge log
* purge log creation guarded by write lock
* if purge log exists, indexer adds its queries to it
* purge thread adds purge log contents after collectiong
add docs |_
add to purge log | <-- no purge log, so dropped!
-| create purge log
collect
commit
_| copy purge log
| swap cache
So I need to make adding docs to the cache and committing protected by the
readlock.
* update _parses_ the docs, but doesn't add them to the cache
* commit() now takes a list of CacheEntry objects
add & parse docs
-| create purge log
collect
_| copy purge log
| swap cache
add to cache |
add to purge log |-
commit |
* problem now is: what happens if another thread commits before the cache is
populated? We can get NPEs from the cache
- silently drop? We don't guarantee that the doc is there until update()
returns, so I think this is OK.
add & parse docs
delete docs
commit
match in index
retrieve from cache -> NPE!
add to cache |
add to purge log |-
commit |