aboutsummaryrefslogtreecommitdiff
path: root/load/load.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-03-14 14:38:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-03-17 12:59:35 +0300
commit0b6b57f9acaa2ec648bf582ff67851331f8e6eef (patch)
tree7ce5da6a1c37f3674762d5514b0a34bf05e38df7 /load/load.cxx
parent637d5650b91cb1da2605e5f7049ccc8bab5591f3 (diff)
Use serializable transaction isolation level
Diffstat (limited to 'load/load.cxx')
-rw-r--r--load/load.cxx37
1 files changed, 23 insertions, 14 deletions
diff --git a/load/load.cxx b/load/load.cxx
index 7786e0e..1a485dd 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -8,6 +8,7 @@
#include <odb/session.hxx>
#include <odb/database.hxx>
+#include <odb/exceptions.hxx>
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
@@ -602,7 +603,8 @@ resolve_dependencies (package& p, database& db)
{
auto c (*d.constraint);
- if (c.min_version && c.max_version && *c.min_version == *c.max_version)
+ if (c.min_version && c.max_version &&
+ *c.min_version == *c.max_version)
{
const version& v (*c.min_version);
q = q && compare_version_eq (vm, v, v.revision != 0);
@@ -755,28 +757,30 @@ try
// If the pager failed, assume it has issued some diagnostics.
//
- return p.wait () ? 0 : 2;
+ return p.wait () ? 0 : 1;
}
if (argc < 2)
{
cerr << "error: configuration file path argument expected" << endl
<< help_info << endl;
- return 2;
+ return 1;
}
if (argc > 2)
{
cerr << "error: unexpected argument encountered" << endl
<< help_info << endl;
- return 2;
+ return 1;
}
- odb::pgsql::database db (ops.db_user (),
- ops.db_password (),
- ops.db_name (),
- ops.db_host (),
- ops.db_port ());
+ odb::pgsql::database db (
+ ops.db_user (),
+ ops.db_password (),
+ ops.db_name (),
+ ops.db_host (),
+ ops.db_port (),
+ "options='-c default_transaction_isolation=serializable'");
// Prevent several brep-load/migrate instances from updating DB
// simultaneously.
@@ -791,7 +795,7 @@ try
{
cerr << "error: database schema differs from the current one" << endl
<< " info: use brep-migrate to migrate the database" << endl;
- return 2;
+ return 1;
}
// Load the description of all the internal repositories from the
@@ -856,21 +860,26 @@ try
catch (const database_locked&)
{
cerr << "brep-load or brep-migrate instance is running" << endl;
- return 1;
+ return 2;
+}
+catch (const recoverable& e)
+{
+ cerr << "database recoverable error: " << e.what () << endl;
+ return 3;
}
catch (const cli::exception& e)
{
cerr << "error: " << e << endl << help_info << endl;
- return 2;
+ return 1;
}
catch (const failed&)
{
- return 2; // Diagnostics has already been issued.
+ return 1; // Diagnostics has already been issued.
}
// Fully qualified to avoid ambiguity with odb exception.
//
catch (const std::exception& e)
{
cerr << "error: " << e.what () << endl;
- return 2;
+ return 1;
}