Commit 130c9dbc authored by Frances Wong's avatar Frances Wong

Fixed typos in the Transactions and Threading page.

parent 8a61d748
...@@ -151,7 +151,7 @@ them with the ``with`` statement directly:: ...@@ -151,7 +151,7 @@ them with the ``with`` statement directly::
When used as a context manager, a transaction manager explicitly When used as a context manager, a transaction manager explicitly
begins a new transaction, executes the code block and commits the begins a new transaction, executes the code block and commits the
transaction if there isn't an error and aborts it of there is an transaction if there isn't an error and aborts it if there is an
error. error.
We used ``as trans`` above to get the transaction. We used ``as trans`` above to get the transaction.
...@@ -242,7 +242,7 @@ connections will get a conflict error when it tries to commit:: ...@@ -242,7 +242,7 @@ connections will get a conflict error when it tries to commit::
... ...
ZODB.POSException.ConflictError: ... ZODB.POSException.ConflictError: ...
If we executed this code, we'd get ``ConflictError`` exception on the If we executed this code, we'd get a ``ConflictError`` exception on the
last line. After a conflict error is raised, we'd need to abort the last line. After a conflict error is raised, we'd need to abort the
transaction, or begin a new one, at which point we'd see the data as transaction, or begin a new one, at which point we'd see the data as
written by the other connection: written by the other connection:
...@@ -267,7 +267,7 @@ Retrying transactions ...@@ -267,7 +267,7 @@ Retrying transactions
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The most common way to deal with conflict errors is to catch them and The most common way to deal with conflict errors is to catch them and
retry transactions. To do this manually, involves code that looks retry transactions. To do this manually involves code that looks
something like this:: something like this::
max_attempts = 3 max_attempts = 3
...@@ -325,12 +325,12 @@ Commonly used objects that implement conflict resolution are ...@@ -325,12 +325,12 @@ Commonly used objects that implement conflict resolution are
buckets and ``Length`` objects provided by the `BTree buckets and ``Length`` objects provided by the `BTree
<https://pythonhosted.org/BTrees/>`_ package. <https://pythonhosted.org/BTrees/>`_ package.
The main data structures provided by BTrees: BTrees and TreeSets, The main data structures provided by BTrees, BTrees and TreeSets,
spread their data over multiple objects. The leaf-level objects, spread their data over multiple objects. The leaf-level objects,
called *buckets*, allow distinct keys to be updated without causing called *buckets*, allow distinct keys to be updated without causing
conflicts [#usually-avoids-conflicts]_. conflicts [#usually-avoids-conflicts]_.
``Length`` objects are conflict-free counters, that merge changes by ``Length`` objects are conflict-free counters that merge changes by
simply accumulating changes. simply accumulating changes.
.. caution:: .. caution::
...@@ -353,7 +353,7 @@ can be broken in non-obvious ways. For example a Web API that splits ...@@ -353,7 +353,7 @@ can be broken in non-obvious ways. For example a Web API that splits
logical operations over multiple web requests, as is often done in logical operations over multiple web requests, as is often done in
`REST `REST
<https://en.wikipedia.org/wiki/Representational_state_transfer>`_ <https://en.wikipedia.org/wiki/Representational_state_transfer>`_
APIs, violate this rule. APIs, violates this rule.
Partial transaction error recovery using savepoints Partial transaction error recovery using savepoints
--------------------------------------------------- ---------------------------------------------------
...@@ -395,7 +395,7 @@ ZODB supports concurrency through transactions. Multiple programs ...@@ -395,7 +395,7 @@ ZODB supports concurrency through transactions. Multiple programs
[#wtf-program]_ can operate independently in separate transactions. [#wtf-program]_ can operate independently in separate transactions.
They synchronize at transaction boundaries. They synchronize at transaction boundaries.
The most common way to run ZODB is with each program running in it's The most common way to run ZODB is with each program running in its
own thread. Usually the thread-local transaction manager is used. own thread. Usually the thread-local transaction manager is used.
You can use multiple threads per transaction and you can run multiple You can use multiple threads per transaction and you can run multiple
...@@ -441,7 +441,7 @@ Some things to keep in mind when utilizing multiple processes: ...@@ -441,7 +441,7 @@ Some things to keep in mind when utilizing multiple processes:
split due to added objects causing them to exceed their maximum size. split due to added objects causing them to exceed their maximum size.
.. [#undo] Transactions can't be rolled back, but they may be undone .. [#undo] Transactions can't be rolled back, but they may be undone
in some cases, especially of subsequent transactions in some cases, especially if subsequent transactions
haven't modified the same objects. haven't modified the same objects.
.. [#bad-idea-using-multiple-threads-per-transaction] While it's .. [#bad-idea-using-multiple-threads-per-transaction] While it's
......
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