Commit c2a36e9c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9bfac376
......@@ -541,35 +541,33 @@ type blkLoadState struct {
// See "3) for */head/data the following invariant is maintained..."
type zodbCacheControl struct {}
func (cc *zodbCacheControl) WantEvict(obj zodb.IPersistent) bool {
func (_ *zodbCacheControl) PCacheClassify(obj zodb.IPersistent) zodb.PCachePolicy {
switch obj.(type) {
default:
return true
// XXX ZBlk should be in ghost state - else we keep ZBlk data in cache
// ZBlk* should be in cache but without data
case *ZBlk0:
return zodb.PCachePinObject | zodb.PCacheNonTemporal
case *ZBlk1:
return zodb.PCachePinObject | zodb.PCacheNonTemporal
// ZBigFile btree index should be in cache with data
case *btree.LOBTree:
return zodb.PCachePinObject | zodb.PCacheKeepState
case *btree.LOBucket:
return zodb.PCachePinObject | zodb.PCacheKeepState
// don't let ZData to pollute the cache
case *ZData:
return zodb.PCacheNonTemporal
// for performance reason we also keep ZBigFile in cache.
//
// ZBigFile is top-level object that is used on every block load, and
// it would be a waste to evict ZBigFile state from cache.
case *ZBigFile:
// FIXME we need to keep ZBigFile in cache: even if we keep a pointer
// to ZBigFile, but it is allowed to drop its state, it will release
// pointer to LOBTree object and, consequently, that LOBTree object,
// even if it was marked not to be released from cache will be GC'ed by
// go runtime, and the cache will loose its weak reference to it.
// XXX however we cannot protect ZBigFile from releasing state - as
// any object can be explicitly invalidated.
//
// FIXME -> teach zodb.LiveCache to keep object by itself
return zodb.PCachePinObject | zodb.PCacheKeepState
}
return false
return 0
}
func traceWatch(format string, argv ...interface{}) {
......@@ -1521,7 +1519,7 @@ func main() {
// open zodb storage/db/connection
ctx := context.Background() // XXX + timeout?
zstor, err := zodb.OpenStorage(ctx, zurl, &zodb.OpenOptions{
zstor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{
ReadOnly: true,
})
if err != nil {
......
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