Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/sqlite/src/test/jrnlmode2.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/jrnlmode.test ('k') | third_party/sqlite/src/test/jrnlmode3.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/jrnlmode2.test
diff --git a/third_party/sqlite/src/test/jrnlmode2.test b/third_party/sqlite/src/test/jrnlmode2.test
index 9a1fe37c3f1ca4a8842bf88b5d0b2268c5db781c..dc3bc270b4231803e218da204cb86404d2a228b0 100644
--- a/third_party/sqlite/src/test/jrnlmode2.test
+++ b/third_party/sqlite/src/test/jrnlmode2.test
@@ -9,7 +9,6 @@
#
#***********************************************************************
#
-# $Id: jrnlmode2.test,v 1.6 2009/06/05 17:09:12 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -20,10 +19,33 @@ ifcapable {!pager_pragmas} {
}
#-------------------------------------------------------------------------
-# Test overview:
+# The tests in this file check that the following two bugs (both now fixed)
+# do not reappear.
#
-# jrnlmode2-1.*: Demonstrate bug #3745
-# jrnlmode2-2.*: Demonstrate bug #3751
+# jrnlmode2-1.*: Demonstrate bug #3745:
+#
+# In persistent journal mode, if:
+#
+# * There is a persistent journal in the file-system, AND
+# * there exists a connection with a shared lock on the db file,
+#
+# then a second connection cannot open a read-transaction on the database.
+# The reason is because while determining that the persistent-journal is
+# not a hot-journal, SQLite currently grabs an exclusive lock on the
+# database file. If this fails because another connection has a shared
+# lock, then SQLITE_BUSY is returned to the user.
+#
+# jrnlmode2-2.*: Demonstrate bug #3751:
+#
+# If a connection is opened in SQLITE_OPEN_READONLY mode, the underlying
+# unix file descriptor on the database file is opened in O_RDONLY mode.
+#
+# When SQLite queries the database file for the schema in order to compile
+# the SELECT statement, it sees the empty journal in the file system, it
+# attempts to obtain an exclusive lock on the database file (this is a
+# bug). The attempt to obtain an exclusive (write) lock on a read-only file
+# fails at the OS level. Under unix, fcntl() reports an EBADF - "Bad file
+# descriptor" - error.
#
do_test jrnlmode2-1.1 {
@@ -46,6 +68,8 @@ do_test jrnlmode2-1.3 {
do_test jrnlmode2-1.4 {
execsql {
INSERT INTO t1 VALUES(3, 4);
+ }
+ execsql {
BEGIN;
SELECT * FROM t1;
}
@@ -87,9 +111,9 @@ do_test jrnlmode2-2.4 {
} {0 {1 2 3 4 5 6}}
do_test jrnlmode2-2.5 {
+ db close
file delete test.db-journal
} {}
-
do_test jrnlmode2-2.6 {
sqlite3 db2 test.db -readonly 1
catchsql { SELECT * FROM t1 } db2
« no previous file with comments | « third_party/sqlite/src/test/jrnlmode.test ('k') | third_party/sqlite/src/test/jrnlmode3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698