Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Kirill Smelkov
ZEO
Commits
2af9a369
Commit
2af9a369
authored
May 14, 2004
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain why it's a Bad Idea to use a persistent object as a BTree key.
parent
4dcfe979
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
doc/guide/modules.tex
doc/guide/modules.tex
+21
-0
No files found.
doc/guide/modules.tex
View file @
2af9a369
...
@@ -360,8 +360,29 @@ only with great care:
...
@@ -360,8 +360,29 @@ only with great care:
Any part of a comparison implementation that relies (explicitly
Any part of a comparison implementation that relies (explicitly
or implicitly) on an address-based comparison result will
or implicitly) on an address-based comparison result will
eventually cause serious failure.
eventually cause serious failure.
\item
Do not use
\class
{
Persistent
}
objects as keys, or objects of a
subclass of
\class
{
Persistent
}
.
\end{enumerate}
\end{enumerate}
That last item may be surprising. It stems from details of how
conflict resolution is implemented: the states passed to conflict
resolution do not materialize persistent subobjects (if a persistent
object P is a key in a BTree, then P is a subobject of the bucket
containing P). Instead, if an object O references a persistent subobject
P directly, and O is involved in a conflict, the states passed to
conflict resolution contain an instance of an internal
\class
{
PersistentReference
}
stub class everywhere O references P.
Two
\class
{
PersistentReference
}
instances compare equal if and only if
they "represent" the same persistent object; when they're not equal,
they compare by memory address, and, as expalined before, memory-based
comparison must never happen in a sane persistent BTree. Note that it
doesn't help in this case if your
\class
{
Persistent
}
subclass defines
a sane
\method
{__
cmp
__
()
}
method: conflict resolution doesn't know
about your class, and so also doesn't know about its
\method
{__
cmp
__
()
}
method. It only sees instances of the internal
\class
{
PersistentReference
}
stub class.
\subsubsection
{
Iteration and Mutation
}
\subsubsection
{
Iteration and Mutation
}
...
...
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