Advertisement
Guest User

Untitled

a guest
Jul 28th, 2011
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.58 KB | None | 0 0
  1. --- db_bench_sqlite3.cc.orig    2011-07-28 23:46:04.000000000 +0400
  2. +++ db_bench_sqlite3.cc.5x  2011-07-29 04:23:52.000000000 +0400
  3. @@ -74,7 +74,7 @@
  4.  static bool FLAGS_transaction = true;
  5.  
  6.  // If true, we enable Write-Ahead Logging
  7. -static bool FLAGS_WAL_enabled = false;
  8. +static bool FLAGS_WAL_enabled = true;
  9.  
  10.  inline
  11.  static void ExecErrorCheck(int status, char *err_msg) {
  12. @@ -454,10 +454,10 @@
  13.  
  14.      // Change locking mode to exclusive and create tables/index for database
  15.      std::string locking_stmt = "PRAGMA locking_mode = EXCLUSIVE";
  16. +    std::string wal_stmt = "PRAGMA wal_autocheckpoint = 4096";
  17.      std::string create_stmt =
  18.            "CREATE TABLE test (key blob, value blob, PRIMARY KEY(key))";
  19. -    std::string index_stmt = "CREATE INDEX keyindex ON test (key)";
  20. -    std::string stmt_array[] = { locking_stmt, create_stmt, index_stmt };
  21. +    std::string stmt_array[] = { locking_stmt, wal_stmt, create_stmt };
  22.      int stmt_array_length = sizeof(stmt_array) / sizeof(std::string);
  23.      for (int i = 0; i < stmt_array_length; i++) {
  24.        status = sqlite3_exec(db_, stmt_array[i].c_str(), NULL, NULL, &err_msg);
  25. @@ -494,7 +494,7 @@
  26.      std::string end_trans_str = "END TRANSACTION;";
  27.  
  28.      // Check for synchronous flag in options
  29. -    std::string sync_stmt = (write_sync) ? "PRAGMA synchronous = FULL" :
  30. +    std::string sync_stmt = (write_sync) ? "PRAGMA synchronous = NORMAL" :
  31.                                             "PRAGMA synchronous = OFF";
  32.      status = sqlite3_exec(db_, sync_stmt.c_str(), NULL, NULL, &err_msg);
  33.      ExecErrorCheck(status, err_msg);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement