# # patch "ChangeLog" # from [2f5adc260a5402249b85ae8d6122a82a41155b5b] # to [5fe57d4a17b17950075a1a6a295cc41c815e6d5b] # # patch "database.cc" # from [7700f558782068baadcacb73f7623ad2b7933456] # to [b5dd1769a45bb7f5825779d69c7c78ff31d2eaa1] # # patch "schema.sql" # from [d25e530b103ebfafad30760aeac1dc01393e15f1] # to [cf9587d6168507c6fe801b0948b3d1117741f59b] # # patch "schema_migration.cc" # from [36680a976cfb5fe666ace184da3fa68dce5da1a5] # to [76589f0bdcb17e1118fc8a771affa6b76ff7816e] # ======================================================================== --- ChangeLog 2f5adc260a5402249b85ae8d6122a82a41155b5b +++ ChangeLog 5fe57d4a17b17950075a1a6a295cc41c815e6d5b @@ -1,5 +1,12 @@ 2005-10-14 Matthew Gregan + * database.cc, schema.sql, schema_migration.cc: Use SQLite 3's + exclusive locking whereever we start a new transaction; allows + monotone to report database locking errors earlier if a second + monotone process attempts to perform database operations. + +2005-10-14 Matthew Gregan + * commands.cc (message_width): Refactor into display_width() and remove message_width(). * transforms.{cc,hh} (display_width): Rename length() to ======================================================================== --- database.cc 7700f558782068baadcacb73f7623ad2b7933456 +++ database.cc b5dd1769a45bb7f5825779d69c7c78ff31d2eaa1 @@ -319,7 +319,7 @@ dump_request req; req.out = &out; req.sql = sql(); - out << "BEGIN TRANSACTION;\n"; + out << "BEGIN EXCLUSIVE;\n"; int res; res = sqlite3_exec(req.sql, "SELECT name, type, sql FROM sqlite_master " @@ -671,7 +671,7 @@ database::begin_transaction() { if (transaction_level == 0) - execute("BEGIN"); + execute("BEGIN EXCLUSIVE"); transaction_level++; } ======================================================================== --- schema.sql d25e530b103ebfafad30760aeac1dc01393e15f1 +++ schema.sql cf9587d6168507c6fe801b0948b3d1117741f59b @@ -14,7 +14,7 @@ -- see the file COPYING for details -- Transactions avoid syncing for each action, db init gets faster. -BEGIN; +BEGIN EXCLUSIVE; -- primary data structures concerned with storing and -- versionning state-of-tree configurations ======================================================================== --- schema_migration.cc 36680a976cfb5fe666ace184da3fa68dce5da1a5 +++ schema_migration.cc 76589f0bdcb17e1118fc8a771affa6b76ff7816e @@ -209,7 +209,7 @@ if (i->first == init) { - if (sqlite3_exec(sql, "BEGIN", NULL, NULL, NULL) != SQLITE_OK) + if (sqlite3_exec(sql, "BEGIN EXCLUSIVE", NULL, NULL, NULL) != SQLITE_OK) throw runtime_error("error at transaction BEGIN statement"); migrating = true; }