Fixed cache corruption when primary key is purged from cache but node is still cached with secondary key
This commit is contained in:
parent
3598f6bd3f
commit
42cc2d9ffb
1 changed files with 9 additions and 1 deletions
|
@ -195,6 +195,10 @@ public final class NodeManager {
|
||||||
|
|
||||||
if (node != null && node.getState() != Node.INVALID) {
|
if (node != null && node.getState() != Node.INVALID) {
|
||||||
// tx.timer.endEvent ("getNode "+kstr);
|
// tx.timer.endEvent ("getNode "+kstr);
|
||||||
|
// if we didn't fetch the node via its primary key, refresh the primary key in the cache.
|
||||||
|
// otherwise we risk cache corroption (duplicate node creation) if the node is fetched by its primary key
|
||||||
|
if (!rel.usesPrimaryKey ())
|
||||||
|
cache.put (node.getKey (), node);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +228,12 @@ public final class NodeManager {
|
||||||
} // synchronized
|
} // synchronized
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node != null)
|
if (node != null) {
|
||||||
|
// update primary key in cache, see above
|
||||||
|
if (!rel.usesPrimaryKey ())
|
||||||
|
cache.put (node.getKey (), node);
|
||||||
tx.visitCleanNode (node.getKey (), node);
|
tx.visitCleanNode (node.getKey (), node);
|
||||||
|
}
|
||||||
|
|
||||||
// tx.timer.endEvent ("getNode "+kstr);
|
// tx.timer.endEvent ("getNode "+kstr);
|
||||||
return node;
|
return node;
|
||||||
|
|
Loading…
Add table
Reference in a new issue