-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Denis Krienbühl
committed
Feb 9, 2015
1 parent
7bb8fb8
commit 93db11b
Showing
6 changed files
with
94 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FAQ | ||
=== | ||
|
||
Why is *Database X* not an option? / Why does Postgresql < 9.1 not work? | ||
------------------------------------------------------------------------ | ||
|
||
seantis.reservation relies on a Postgresql feature introduced in 9.1 | ||
called "Serialized Transactions". Serialized transactions are | ||
transactions that, run on multiuser systems, are guaranteed to behave | ||
like they are run on a singleuser system. | ||
|
||
In other words, serialized transactions make it much easier to ensure | ||
that the data stays sane even when multiple write transactions are run | ||
concurrently. | ||
|
||
Other databases, like Oracle, also support this feature and it would be | ||
possible to support those databases as well. Patches welcome. | ||
|
||
Note that MySQL has serialized transactions with InnoDB, but the | ||
documentation does not make any clear guarantees and there is a debate | ||
going on: | ||
|
||
http://stackoverflow.com/questions/6269471/does-mysql-innodb-implement-true-serializable-isolation | ||
|
||
For more information see :ref:`serialized-transactions`. | ||
|
||
Why did you choose SQL anyway? Why not *insert your favorite NoSQL DB here*? | ||
---------------------------------------------------------------------------- | ||
|
||
- If a reservation is granted to you, noone else must get the same | ||
grant. Primary keys and transactions are a natural fit to ensure | ||
that. | ||
|
||
- Our data model is heavily structured and needs to be validated | ||
against a schema. | ||
|
||
- All clients must have the same data at all time. Not just eventually. | ||
|
||
- Complicated queries must be easy to develop as reporting matters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,9 @@ Content | |
:maxdepth: 2 | ||
|
||
concepts | ||
under_the_hood | ||
api | ||
faq | ||
|
||
License | ||
======= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Under the Hood | ||
============== | ||
|
||
.. _serialized-transactions: | ||
|
||
Serialized Transactions | ||
----------------------- | ||
|
||
Working with dateranges in Libres often entails making sure that ranges don't | ||
overlap. This often means that multiple records have to be considered before | ||
a daterange can be changed. | ||
|
||
One way to do this is to lock the relevant records and tables. Thus stopping | ||
concurrent transactions around the same daterange from leaving the | ||
database in an invalid state. | ||
|
||
Libres uses serialized transactions instead, a feature of *proper* | ||
databases like Postgres. Serialized transactions always behave like they were | ||
single user transactions. If two transactions arrive at the very same time, | ||
only one transaction is accepted, while the other is stopped. | ||
|
||
`See the nice documentation on the topic in the postgres manual. | ||
<http://www.postgresql.org/docs/current/static/transaction-iso.html>`_. | ||
|
||
Since serialized transactions are slower than normal transactions, Libres only | ||
employs them for write operations. Read operations are left in the default | ||
transaction level. | ||
|
||
As a user you don't really have to care about this, though you might encounter | ||
one of these errors:: | ||
|
||
psycopg2.extensions.TransactionRollbackError | ||
libres.modules.errors.DirtyReadOnlySession | ||
libres.modules.errors.ModifiedReadOnlySession | ||
|
||
A `TransactionRollbackError` occurs if the transaction you sent was denied | ||
because another serial transaction was let through instead. | ||
|
||
A `DirtyReadOnlySession` error occurs if you wrote something to the database | ||
without comitting it. | ||
|
||
A `ModifiedReadOnlySession` error occurs if you tried to write something to | ||
the database without using the serial transaction. | ||
|
||
See :class:`~libres.context.session.SessionStore`, | ||
:class:`~libres.context.session.SessionProvider`, | ||
:class:`~libres.context.session.Serializable` and | ||
:class:`~libres.context.session.serialized` for implementation details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters