Have sqlite3_snapshot_open() avoid a race condition by taking a shared CHECKPOINTER lock while checking pInfo->nBackfillAttempted.

FossilOrigin-Name: 8084eae0bc4f6513b1147fb890a6b2813f1c0a09
This commit is contained in:
dan
2015-12-10 15:45:15 +00:00
parent c9fb38e7ad
commit 3bf83ccd70
4 changed files with 42 additions and 30 deletions
+7 -6
View File
@@ -57,8 +57,6 @@ do_execsql_test 1.3.2 COMMIT
# Check that a simple case works. Reuse the database created by the
# block of tests above.
#
# UPDATE: This case (2.1) no longer works. 2.2 does.
#
do_execsql_test 2.1.0 {
BEGIN;
SELECT * FROM t1;
@@ -75,8 +73,11 @@ do_test 2.1.1 {
do_test 2.1.2 {
execsql BEGIN
list [catch { sqlite3_snapshot_open db main $snapshot } msg] $msg
} {1 SQLITE_BUSY_SNAPSHOT}
sqlite3_snapshot_open db main $snapshot
execsql {
SELECT * FROM t1;
}
} {1 2 3 4 5 6 7 8}
do_test 2.1.3 {
sqlite3_snapshot_free $snapshot
@@ -99,7 +100,7 @@ do_test 2.2.1 {
}
} {1 2 3 4 5 6 7 8 9 10 11 12}
do_test 2.1.2 {
do_test 2.2.2 {
execsql BEGIN
sqlite3_snapshot_open db main $snapshot
execsql {
@@ -107,7 +108,7 @@ do_test 2.1.2 {
}
} {1 2 3 4 5 6 7 8 9 10}
do_test 2.1.3 {
do_test 2.2.3 {
sqlite3_snapshot_free $snapshot
execsql COMMIT
execsql COMMIT db2