0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-21 11:19:14 +01:00

Omit the antiquated and long-unsupport async extension since it has been

superseded by WAL mode for over a decade.

FossilOrigin-Name: 10b1b86821bfc21377e7ccceb31146ab01aa6eaf418b85a204abcab5b793958e
This commit is contained in:
drh 2024-10-28 15:38:53 +00:00
parent 8625bd64c2
commit 42516b2ef9
19 changed files with 23 additions and 3021 deletions

View File

@ -1585,7 +1585,6 @@ TESTSRC = \
$(TOP)\src\test8.c \ $(TOP)\src\test8.c \
$(TOP)\src\test9.c \ $(TOP)\src\test9.c \
$(TOP)\src\test_autoext.c \ $(TOP)\src\test_autoext.c \
$(TOP)\src\test_async.c \
$(TOP)\src\test_backup.c \ $(TOP)\src\test_backup.c \
$(TOP)\src\test_bestindex.c \ $(TOP)\src\test_bestindex.c \
$(TOP)\src\test_blob.c \ $(TOP)\src\test_blob.c \
@ -1682,7 +1681,6 @@ TESTSRC2 = \
$(SRC01) \ $(SRC01) \
$(SRC07) \ $(SRC07) \
$(SRC10) \ $(SRC10) \
$(TOP)\ext\async\sqlite3async.c \
fts5.c fts5.c
# Header files used by all library source files. # Header files used by all library source files.

View File

@ -1,170 +0,0 @@
NOTE (2012-11-29):
The functionality implemented by this extension has been superseded
by WAL-mode. This module is no longer supported or maintained. The
code is retained for historical reference only.
------------------------------------------------------------------------------
Normally, when SQLite writes to a database file, it waits until the write
operation is finished before returning control to the calling application.
Since writing to the file-system is usually very slow compared with CPU
bound operations, this can be a performance bottleneck. This directory
contains an extension that causes SQLite to perform all write requests
using a separate thread running in the background. Although this does not
reduce the overall system resources (CPU, disk bandwidth etc.) at all, it
allows SQLite to return control to the caller quickly even when writing to
the database, eliminating the bottleneck.
1. Functionality
1.1 How it Works
1.2 Limitations
1.3 Locking and Concurrency
2. Compilation and Usage
3. Porting
1. FUNCTIONALITY
With asynchronous I/O, write requests are handled by a separate thread
running in the background. This means that the thread that initiates
a database write does not have to wait for (sometimes slow) disk I/O
to occur. The write seems to happen very quickly, though in reality
it is happening at its usual slow pace in the background.
Asynchronous I/O appears to give better responsiveness, but at a price.
You lose the Durable property. With the default I/O backend of SQLite,
once a write completes, you know that the information you wrote is
safely on disk. With the asynchronous I/O, this is not the case. If
your program crashes or if a power loss occurs after the database
write but before the asynchronous write thread has completed, then the
database change might never make it to disk and the next user of the
database might not see your change.
You lose Durability with asynchronous I/O, but you still retain the
other parts of ACID: Atomic, Consistent, and Isolated. Many
appliations get along fine without the Durablity.
1.1 How it Works
Asynchronous I/O works by creating a special SQLite "vfs" structure
and registering it with sqlite3_vfs_register(). When files opened via
this vfs are written to (using the vfs xWrite() method), the data is not
written directly to disk, but is placed in the "write-queue" to be
handled by the background thread.
When files opened with the asynchronous vfs are read from
(using the vfs xRead() method), the data is read from the file on
disk and the write-queue, so that from the point of view of
the vfs reader the xWrite() appears to have already completed.
The special vfs is registered (and unregistered) by calls to the
API functions sqlite3async_initialize() and sqlite3async_shutdown().
See section "Compilation and Usage" below for details.
1.2 Limitations
In order to gain experience with the main ideas surrounding asynchronous
IO, this implementation is deliberately kept simple. Additional
capabilities may be added in the future.
For example, as currently implemented, if writes are happening at a
steady stream that exceeds the I/O capability of the background writer
thread, the queue of pending write operations will grow without bound.
If this goes on for long enough, the host system could run out of memory.
A more sophisticated module could to keep track of the quantity of
pending writes and stop accepting new write requests when the queue of
pending writes grows too large.
1.3 Locking and Concurrency
Multiple connections from within a single process that use this
implementation of asynchronous IO may access a single database
file concurrently. From the point of view of the user, if all
connections are from within a single process, there is no difference
between the concurrency offered by "normal" SQLite and SQLite
using the asynchronous backend.
If file-locking is enabled (it is enabled by default), then connections
from multiple processes may also read and write the database file.
However concurrency is reduced as follows:
* When a connection using asynchronous IO begins a database
transaction, the database is locked immediately. However the
lock is not released until after all relevant operations
in the write-queue have been flushed to disk. This means
(for example) that the database may remain locked for some
time after a "COMMIT" or "ROLLBACK" is issued.
* If an application using asynchronous IO executes transactions
in quick succession, other database users may be effectively
locked out of the database. This is because when a BEGIN
is executed, a database lock is established immediately. But
when the corresponding COMMIT or ROLLBACK occurs, the lock
is not released until the relevant part of the write-queue
has been flushed through. As a result, if a COMMIT is followed
by a BEGIN before the write-queue is flushed through, the database
is never unlocked,preventing other processes from accessing
the database.
File-locking may be disabled at runtime using the sqlite3async_control()
API (see below). This may improve performance when an NFS or other
network file-system, as the synchronous round-trips to the server be
required to establish file locks are avoided. However, if multiple
connections attempt to access the same database file when file-locking
is disabled, application crashes and database corruption is a likely
outcome.
2. COMPILATION AND USAGE
The asynchronous IO extension consists of a single file of C code
(sqlite3async.c), and a header file (sqlite3async.h) that defines the
C API used by applications to activate and control the modules
functionality.
To use the asynchronous IO extension, compile sqlite3async.c as
part of the application that uses SQLite. Then use the API defined
in sqlite3async.h to initialize and configure the module.
The asynchronous IO VFS API is described in detail in comments in
sqlite3async.h. Using the API usually consists of the following steps:
1. Register the asynchronous IO VFS with SQLite by calling the
sqlite3async_initialize() function.
2. Create a background thread to perform write operations and call
sqlite3async_run().
3. Use the normal SQLite API to read and write to databases via
the asynchronous IO VFS.
Refer to sqlite3async.h for details.
3. PORTING
Currently the asynchronous IO extension is compatible with win32 systems
and systems that support the pthreads interface, including Mac OSX, Linux,
and other varieties of Unix.
To port the asynchronous IO extension to another platform, the user must
implement mutex and condition variable primitives for the new platform.
Currently there is no externally available interface to allow this, but
modifying the code within sqlite3async.c to include the new platforms
concurrency primitives is relatively easy. Search within sqlite3async.c
for the comment string "PORTING FUNCTIONS" for details. Then implement
new versions of each of the following:
static void async_mutex_enter(int eMutex);
static void async_mutex_leave(int eMutex);
static void async_cond_wait(int eCond, int eMutex);
static void async_cond_signal(int eCond);
static void async_sched_yield(void);
The functionality required of each of the above functions is described
in comments in sqlite3async.c.

File diff suppressed because it is too large Load Diff

View File

@ -1,222 +0,0 @@
#ifndef __SQLITEASYNC_H_
#define __SQLITEASYNC_H_ 1
/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif
#define SQLITEASYNC_VFSNAME "sqlite3async"
/*
** THREAD SAFETY NOTES:
**
** Of the four API functions in this file, the following are not threadsafe:
**
** sqlite3async_initialize()
** sqlite3async_shutdown()
**
** Care must be taken that neither of these functions is called while
** another thread may be calling either any sqlite3async_XXX() function
** or an sqlite3_XXX() API function related to a database handle that
** is using the asynchronous IO VFS.
**
** These functions:
**
** sqlite3async_run()
** sqlite3async_control()
**
** are threadsafe. It is quite safe to call either of these functions even
** if another thread may also be calling one of them or an sqlite3_XXX()
** function related to a database handle that uses the asynchronous IO VFS.
*/
/*
** Initialize the asynchronous IO VFS and register it with SQLite using
** sqlite3_vfs_register(). If the asynchronous VFS is already initialized
** and registered, this function is a no-op. The asynchronous IO VFS
** is registered as "sqlite3async".
**
** The asynchronous IO VFS does not make operating system IO requests
** directly. Instead, it uses an existing VFS implementation for all
** required file-system operations. If the first parameter to this function
** is NULL, then the current default VFS is used for IO. If it is not
** NULL, then it must be the name of an existing VFS. In other words, the
** first argument to this function is passed to sqlite3_vfs_find() to
** locate the VFS to use for all real IO operations. This VFS is known
** as the "parent VFS".
**
** If the second parameter to this function is non-zero, then the
** asynchronous IO VFS is registered as the default VFS for all SQLite
** database connections within the process. Otherwise, the asynchronous IO
** VFS is only used by connections opened using sqlite3_open_v2() that
** specifically request VFS "sqlite3async".
**
** If a parent VFS cannot be located, then SQLITE_ERROR is returned.
** In the unlikely event that operating system specific initialization
** fails (win32 systems create the required critical section and event
** objects within this function), then SQLITE_ERROR is also returned.
** Finally, if the call to sqlite3_vfs_register() returns an error, then
** the error code is returned to the user by this function. In all three
** of these cases, intialization has failed and the asynchronous IO VFS
** is not registered with SQLite.
**
** Otherwise, if no error occurs, SQLITE_OK is returned.
*/
int sqlite3async_initialize(const char *zParent, int isDefault);
/*
** This function unregisters the asynchronous IO VFS using
** sqlite3_vfs_unregister().
**
** On win32 platforms, this function also releases the small number of
** critical section and event objects created by sqlite3async_initialize().
*/
void sqlite3async_shutdown(void);
/*
** This function may only be called when the asynchronous IO VFS is
** installed (after a call to sqlite3async_initialize()). It processes
** zero or more queued write operations before returning. It is expected
** (but not required) that this function will be called by a different
** thread than those threads that use SQLite. The "background thread"
** that performs IO.
**
** How many queued write operations are performed before returning
** depends on the global setting configured by passing the SQLITEASYNC_HALT
** verb to sqlite3async_control() (see below for details). By default
** this function never returns - it processes all pending operations and
** then blocks waiting for new ones.
**
** If multiple simultaneous calls are made to sqlite3async_run() from two
** or more threads, then the calls are serialized internally.
*/
void sqlite3async_run(void);
/*
** This function may only be called when the asynchronous IO VFS is
** installed (after a call to sqlite3async_initialize()). It is used
** to query or configure various parameters that affect the operation
** of the asynchronous IO VFS. At present there are three parameters
** supported:
**
** * The "halt" parameter, which configures the circumstances under
** which the sqlite3async_run() parameter is configured.
**
** * The "delay" parameter. Setting the delay parameter to a non-zero
** value causes the sqlite3async_run() function to sleep for the
** configured number of milliseconds between each queued write
** operation.
**
** * The "lockfiles" parameter. This parameter determines whether or
** not the asynchronous IO VFS locks the database files it operates
** on. Disabling file locking can improve throughput.
**
** This function is always passed two arguments. When setting the value
** of a parameter, the first argument must be one of SQLITEASYNC_HALT,
** SQLITEASYNC_DELAY or SQLITEASYNC_LOCKFILES. The second argument must
** be passed the new value for the parameter as type "int".
**
** When querying the current value of a paramter, the first argument must
** be one of SQLITEASYNC_GET_HALT, GET_DELAY or GET_LOCKFILES. The second
** argument to this function must be of type (int *). The current value
** of the queried parameter is copied to the memory pointed to by the
** second argument. For example:
**
** int eCurrentHalt;
** int eNewHalt = SQLITEASYNC_HALT_IDLE;
**
** sqlite3async_control(SQLITEASYNC_HALT, eNewHalt);
** sqlite3async_control(SQLITEASYNC_GET_HALT, &eCurrentHalt);
** assert( eNewHalt==eCurrentHalt );
**
** See below for more detail on each configuration parameter.
**
** SQLITEASYNC_HALT:
**
** This is used to set the value of the "halt" parameter. The second
** argument must be one of the SQLITEASYNC_HALT_XXX symbols defined
** below (either NEVER, IDLE and NOW).
**
** If the parameter is set to NEVER, then calls to sqlite3async_run()
** never return. This is the default setting. If the parameter is set
** to IDLE, then calls to sqlite3async_run() return as soon as the
** queue of pending write operations is empty. If the parameter is set
** to NOW, then calls to sqlite3async_run() return as quickly as
** possible, without processing any pending write requests.
**
** If an attempt is made to set this parameter to an integer value other
** than SQLITEASYNC_HALT_NEVER, IDLE or NOW, then sqlite3async_control()
** returns SQLITE_MISUSE and the current value of the parameter is not
** modified.
**
** Modifying the "halt" parameter affects calls to sqlite3async_run()
** made by other threads that are currently in progress.
**
** SQLITEASYNC_DELAY:
**
** This is used to set the value of the "delay" parameter. If set to
** a non-zero value, then after completing a pending write request, the
** sqlite3async_run() function sleeps for the configured number of
** milliseconds.
**
** If an attempt is made to set this parameter to a negative value,
** sqlite3async_control() returns SQLITE_MISUSE and the current value
** of the parameter is not modified.
**
** Modifying the "delay" parameter affects calls to sqlite3async_run()
** made by other threads that are currently in progress.
**
** SQLITEASYNC_LOCKFILES:
**
** This is used to set the value of the "lockfiles" parameter. This
** parameter must be set to either 0 or 1. If set to 1, then the
** asynchronous IO VFS uses the xLock() and xUnlock() methods of the
** parent VFS to lock database files being read and/or written. If
** the parameter is set to 0, then these locks are omitted.
**
** This parameter may only be set when there are no open database
** connections using the VFS and the queue of pending write requests
** is empty. Attempting to set it when this is not true, or to set it
** to a value other than 0 or 1 causes sqlite3async_control() to return
** SQLITE_MISUSE and the value of the parameter to remain unchanged.
**
** If this parameter is set to zero, then it is only safe to access the
** database via the asynchronous IO VFS from within a single process. If
** while writing to the database via the asynchronous IO VFS the database
** is also read or written from within another process, or via another
** connection that does not use the asynchronous IO VFS within the same
** process, the results are undefined (and may include crashes or database
** corruption).
**
** Alternatively, if this parameter is set to 1, then it is safe to access
** the database from multiple connections within multiple processes using
** either the asynchronous IO VFS or the parent VFS directly.
*/
int sqlite3async_control(int op, ...);
/*
** Values that can be used as the first argument to sqlite3async_control().
*/
#define SQLITEASYNC_HALT 1
#define SQLITEASYNC_GET_HALT 2
#define SQLITEASYNC_DELAY 3
#define SQLITEASYNC_GET_DELAY 4
#define SQLITEASYNC_LOCKFILES 5
#define SQLITEASYNC_GET_LOCKFILES 6
/*
** If the first argument to sqlite3async_control() is SQLITEASYNC_HALT,
** the second argument should be one of the following.
*/
#define SQLITEASYNC_HALT_NEVER 0 /* Never halt (default value) */
#define SQLITEASYNC_HALT_NOW 1 /* Halt as soon as possible */
#define SQLITEASYNC_HALT_IDLE 2 /* Halt when write-queue is empty */
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
#endif /* ifndef __SQLITEASYNC_H_ */

View File

@ -307,7 +307,7 @@ T.cc.sqlite ?= $(T.cc)
# #
CFLAGS.intree_includes = \ CFLAGS.intree_includes = \
-I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \ -I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \
-I$(TOP)/ext/fts3 -I$(TOP)/ext/async -I$(TOP)/ext/session \ -I$(TOP)/ext/fts3 -I$(TOP)/ext/session \
-I$(TOP)/ext/misc -I$(TOP)/ext/userauth -I$(TOP)/ext/misc -I$(TOP)/ext/userauth
T.cc.sqlite += $(CFLAGS.intree_includes) T.cc.sqlite += $(CFLAGS.intree_includes)
@ -627,7 +627,6 @@ TESTSRC = \
$(TOP)/src/test8.c \ $(TOP)/src/test8.c \
$(TOP)/src/test9.c \ $(TOP)/src/test9.c \
$(TOP)/src/test_autoext.c \ $(TOP)/src/test_autoext.c \
$(TOP)/src/test_async.c \
$(TOP)/src/test_backup.c \ $(TOP)/src/test_backup.c \
$(TOP)/src/test_bestindex.c \ $(TOP)/src/test_bestindex.c \
$(TOP)/src/test_blob.c \ $(TOP)/src/test_blob.c \
@ -764,7 +763,6 @@ TESTSRC2 = \
$(TOP)/ext/fts3/fts3_term.c \ $(TOP)/ext/fts3/fts3_term.c \
$(TOP)/ext/fts3/fts3_tokenizer.c \ $(TOP)/ext/fts3/fts3_tokenizer.c \
$(TOP)/ext/fts3/fts3_write.c \ $(TOP)/ext/fts3/fts3_write.c \
$(TOP)/ext/async/sqlite3async.c \
$(TOP)/ext/session/sqlite3session.c \ $(TOP)/ext/session/sqlite3session.c \
$(TOP)/ext/misc/stmt.c \ $(TOP)/ext/misc/stmt.c \
fts5.c fts5.c

View File

@ -1,11 +1,11 @@
C Omit\sext/consio\sfrom\sthe\stree.\s\sNo\slonger\sneeded\sor\ssupported. C Omit\sthe\santiquated\sand\slong-unsupport\sasync\sextension\ssince\sit\shas\sbeen\nsuperseded\sby\sWAL\smode\sfor\sover\sa\sdecade.
D 2024-10-28T14:53:45.379 D 2024-10-28T15:38:53.409
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2 F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2
F Makefile.in 02ea00ff433902dba369d4a55b3aeb6bb1ffe2d82f777194984b8cdd7ed7c3ad F Makefile.in 02ea00ff433902dba369d4a55b3aeb6bb1ffe2d82f777194984b8cdd7ed7c3ad
F Makefile.linux-generic 69b54c58ab2424a0d30f340d9defd7e87c25690a55b77acb9bdc657bd9a223f1 F Makefile.linux-generic 69b54c58ab2424a0d30f340d9defd7e87c25690a55b77acb9bdc657bd9a223f1
F Makefile.msc d2d927177660945599ba88ea32f1ab5c261a96a8797380b99766e27f3aea7e4f F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
F VERSION 8dc0c3df15fd5ff0622f88fc483533fce990b1cbb2f5fb9fdfb4dbd71eef2889 F VERSION 8dc0c3df15fd5ff0622f88fc483533fce990b1cbb2f5fb9fdfb4dbd71eef2889
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
@ -68,9 +68,6 @@ F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc1404
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d
F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c
@ -705,7 +702,7 @@ F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b5
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk ed437c3fb9ef480a534aa3205fff1f380ce776c1aa1069e3623b692770f86404 F main.mk c5e17513c0f68b514d0f1b5afabcc0aabfedf8ebba0e6314435df1edcb7e8fd4
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@ -804,7 +801,6 @@ F src/test5.c bb87279ed12e199486894e6c83e58dc8cd1de9524ace171d59219d3ab696a0c1
F src/test6.c 763b92489f11f4a77b773f0d3b8369ab0edd5292ac794043062c337019f12d8a F src/test6.c 763b92489f11f4a77b773f0d3b8369ab0edd5292ac794043062c337019f12d8a
F src/test8.c 206d8f3cc73950d252906656e2646b5de0d580b07187b635fcb3edd8c2c5fbc0 F src/test8.c 206d8f3cc73950d252906656e2646b5de0d580b07187b635fcb3edd8c2c5fbc0
F src/test9.c 7a708ad27f8fda79113e5e15de66632710958c401e64c2f22bc04e2f5a7a1b62 F src/test9.c 7a708ad27f8fda79113e5e15de66632710958c401e64c2f22bc04e2f5a7a1b62
F src/test_async.c 0101173cf8137ba5473a84a695281fa9dedc2a1d155998c68623f2978017ad98
F src/test_autoext.c 14d4bbd3d0bd1eec0f6d16b29e28cf1e2d0b020d454835f0721a5f68121ac10f F src/test_autoext.c 14d4bbd3d0bd1eec0f6d16b29e28cf1e2d0b020d454835f0721a5f68121ac10f
F src/test_backup.c bd901e3c116c7f3b3bbbd4aae4ce87d99b400c9cbb0a9e7b4610af451d9719a7 F src/test_backup.c bd901e3c116c7f3b3bbbd4aae4ce87d99b400c9cbb0a9e7b4610af451d9719a7
F src/test_bestindex.c 3401bee51665cbf7f9ed2552b5795452a8b86365e4c9ece745b54155a55670c6 F src/test_bestindex.c 3401bee51665cbf7f9ed2552b5795452a8b86365e4c9ece745b54155a55670c6
@ -837,7 +833,7 @@ F src/test_schema.c b06d3ddc3edc173c143878f3edb869dd200d57d918ae2f38820534f9a5e3
F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
F src/test_superlock.c 18355ca274746aa6909e3744163e5deb1196a85d5bc64b9cd377273cef626da7 F src/test_superlock.c 18355ca274746aa6909e3744163e5deb1196a85d5bc64b9cd377273cef626da7
F src/test_syscall.c 9ad7ab39910c16d29411678d91b0d27a7a996a718df5ee93dcd635e846d0275c F src/test_syscall.c 9ad7ab39910c16d29411678d91b0d27a7a996a718df5ee93dcd635e846d0275c
F src/test_tclsh.c 6077f2bdc6b4ea2bace2a0cd6ea48e0a4651007ae7382c13efc0c495eb0c6956 F src/test_tclsh.c c01706ac60bd3176754d3ccd37da74c6ad97c2e14489f8ed71b497c1c0ac0dd4
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424 F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
F src/test_thread.c d7a8bcea7445f37cc2a1f7f81dd6059634f45e0c61bfe80182b02872fb0328bb F src/test_thread.c d7a8bcea7445f37cc2a1f7f81dd6059634f45e0c61bfe80182b02872fb0328bb
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3 F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
@ -919,11 +915,6 @@ F test/analyzeE.test d2ec7921c162cdc33ac8e7eb01f9ebf78100610af7c94c8552bbf551de1
F test/analyzeF.test 40b5cc3ad7b10e81020d7ca86f1417647ecfae7477cfd88acc5aa7ae1068f949 F test/analyzeF.test 40b5cc3ad7b10e81020d7ca86f1417647ecfae7477cfd88acc5aa7ae1068f949
F test/analyzeG.test 623be33038c49648872746c8dd8b23b5792c08fef173c55e82f1b12fca259852 F test/analyzeG.test 623be33038c49648872746c8dd8b23b5792c08fef173c55e82f1b12fca259852
F test/analyzer1.test 459fa02c445ddbf0101a3bad47b34290a35f2e49 F test/analyzer1.test 459fa02c445ddbf0101a3bad47b34290a35f2e49
F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b
F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
F test/atof1.test 7ec56debc04b32e8f9dc87239f4bbb07d84550fb83dd7475b0ead9e83beb35da F test/atof1.test 7ec56debc04b32e8f9dc87239f4bbb07d84550fb83dd7475b0ead9e83beb35da
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061 F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
@ -1417,7 +1408,7 @@ F test/literal2.tcl 1499037beaf661aeecdbe48801220a181d805372a64c6128d5f26bb6a4a8
F test/literal2.test b149e16b5fc9ee6249069a8858ed41052f222014fe0ba7ad43c2fb989c2dada2 F test/literal2.test b149e16b5fc9ee6249069a8858ed41052f222014fe0ba7ad43c2fb989c2dada2
F test/loadext.test faa4f6eed07a5aac35d57fdd7bc07f8fc82464cfd327567c10cf0ba3c86cde04 F test/loadext.test faa4f6eed07a5aac35d57fdd7bc07f8fc82464cfd327567c10cf0ba3c86cde04
F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7 F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7
F test/lock.test be4fe08118fb988fed741f429b7dd5d65e1c90db F test/lock.test 05f346b65040b9a27c032c984e1e509dfef1661135b4f26a3ab6d21358277803
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00 F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
F test/lock4.test 27143363eda1622f03c133efc8db808fc331afd973486cb571ea71cd717d37b8 F test/lock4.test 27143363eda1622f03c133efc8db808fc331afd973486cb571ea71cd717d37b8
@ -1426,7 +1417,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431 F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
F test/lock_common.tcl 2f3f7f2e9637f93ccf609df48ef5b27a50278b6b1cd752b445d52262e5841413 F test/lock_common.tcl 2f3f7f2e9637f93ccf609df48ef5b27a50278b6b1cd752b445d52262e5841413
F test/lookaside.test 5a828e7256f1ee4da8e1bdaa03373a3ccdb0f1ff98dfa82e9b76cb41a45b1083 F test/lookaside.test 5a828e7256f1ee4da8e1bdaa03373a3ccdb0f1ff98dfa82e9b76cb41a45b1083
F test/main.test 1b07447e484d3a3ca8c620c6551258fa51f9cc9fdd56648e8949ea8c836be961 F test/main.test e8752d76233b1c8906cd2c98ad920dba868bd63c87d51d8a2ea5e9cba55dd496
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test 18dd1c4188c81ca79cf123527c71b19ee0c31feb9947fdffb0dc6ceb1436816a F test/malloc.test 18dd1c4188c81ca79cf123527c71b19ee0c31feb9947fdffb0dc6ceb1436816a
F test/malloc3.test 6e88bae6312854a4adb4ecc2a6a5ea8c59b4db778b724ba718e1c43fc8c3c136 F test/malloc3.test 6e88bae6312854a4adb4ecc2a6a5ea8c59b4db778b724ba718e1c43fc8c3c136
@ -1459,7 +1450,7 @@ F test/memdb1.test c737ac9aa5895092332b1dde24fae7ae494b7fcbcd346d22d600891096a38
F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4 F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4
F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c
F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 F test/memleak.test c7478f1195d64887dd1c677edc39fa03b5bf29024e6dcc5b5cc554d7ed00b01f
F test/memsubsys1.test 86b8158752af9188ed5b32a30674a1ef71183e6bc4e6808e815cd658ca9058a6 F test/memsubsys1.test 86b8158752af9188ed5b32a30674a1ef71183e6bc4e6808e815cd658ca9058a6
F test/memsubsys2.test 774b93cb09ca50d1b759bb7c645baa2a9ce172edc3a3da67d5150a26a9fc2a08 F test/memsubsys2.test 774b93cb09ca50d1b759bb7c645baa2a9ce172edc3a3da67d5150a26a9fc2a08
F test/merge1.test 7dd9dc6838bcd0623a069485fe3a8dd498a051c16e1877cf84f506c0d6a29b43 F test/merge1.test 7dd9dc6838bcd0623a069485fe3a8dd498a051c16e1877cf84f506c0d6a29b43
@ -1538,7 +1529,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463 F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463
F test/percentile.test 52ba89d6ee6b65f770972b67dace358bab7cdbd532803d3db157845268e789cd F test/percentile.test 52ba89d6ee6b65f770972b67dace358bab7cdbd532803d3db157845268e789cd
F test/permutations.test 405542f1d659942994a6b38a9e024cf5cfd23eaa68c806aeb24a72d7c9186e80 F test/permutations.test 37650c5286f7d6f322af95cad876b69c6c2c79c28dc649f09de07d3312b1213c
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 11cb9310c42f921918f7f563e3c0b6e70f9f9c3a6a1cf12af8fccb6c574f3882 F test/pragma.test 11cb9310c42f921918f7f563e3c0b6e70f9f9c3a6a1cf12af8fccb6c574f3882
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@ -1784,7 +1775,6 @@ F test/tkt-8454a207b9.test ead80b7a01438ca1436cee029694a96c821346cf1e24f06de12f8
F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356 F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5 F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223
F test/tkt-99378177930f87bd.test 9d6cff39b50d062c813ae1cb0ebbd1b7acf81ecc23ae5d5215e5bb05667dc137 F test/tkt-99378177930f87bd.test 9d6cff39b50d062c813ae1cb0ebbd1b7acf81ecc23ae5d5215e5bb05667dc137
F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667 F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667
F test/tkt-9d68c883.test 16f7cb96781ba579bc2e19bb14b4ad609d9774b6 F test/tkt-9d68c883.test 16f7cb96781ba579bc2e19bb14b4ad609d9774b6
@ -2214,8 +2204,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 6cb7cb7e33835d42cbab2e5468d73de7bb3b01971da078ce1c1344edc11ab1b3 P 1ce8507f732a26508a9b336cb27756a0a8638e14395efdd59b5faef40526ede5
R 00f0377d2b4f46d55243305df3135edf R b9b93d2e2084015bc7fa1134ed3eba38
T *branch * omit-async
T *sym-omit-async *
T -sym-trunk *
U drh U drh
Z 05dc840cebf23762b49de298db68f9dc Z e51dfe59488ba774ddcef48ab38dfbd3
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
1ce8507f732a26508a9b336cb27756a0a8638e14395efdd59b5faef40526ede5 10b1b86821bfc21377e7ccceb31146ab01aa6eaf418b85a204abcab5b793958e

View File

@ -1,241 +0,0 @@
/*
** 2005 December 14
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains a binding of the asynchronous IO extension interface
** (defined in ext/async/sqlite3async.h) to Tcl.
*/
#define TCL_THREADS
#include "tclsqlite.h"
#ifdef SQLITE_ENABLE_ASYNCIO
#include "sqlite3async.h"
#include "sqlite3.h"
#include <assert.h>
/* From main.c */
extern const char *sqlite3ErrName(int);
struct TestAsyncGlobal {
int isInstalled; /* True when async VFS is installed */
} testasync_g = { 0 };
TCL_DECLARE_MUTEX(testasync_g_writerMutex);
/*
** sqlite3async_initialize PARENT-VFS ISDEFAULT
*/
static int SQLITE_TCLAPI testAsyncInit(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
const char *zParent;
int isDefault;
int rc;
if( objc!=3 ){
Tcl_WrongNumArgs(interp, 1, objv, "PARENT-VFS ISDEFAULT");
return TCL_ERROR;
}
zParent = Tcl_GetString(objv[1]);
if( !*zParent ) {
zParent = 0;
}
if( Tcl_GetBooleanFromObj(interp, objv[2], &isDefault) ){
return TCL_ERROR;
}
rc = sqlite3async_initialize(zParent, isDefault);
if( rc!=SQLITE_OK ){
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
return TCL_ERROR;
}
return TCL_OK;
}
/*
** sqlite3async_shutdown
*/
static int SQLITE_TCLAPI testAsyncShutdown(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3async_shutdown();
return TCL_OK;
}
static Tcl_ThreadCreateType tclWriterThread(ClientData pIsStarted){
Tcl_MutexLock(&testasync_g_writerMutex);
*((int *)pIsStarted) = 1;
sqlite3async_run();
Tcl_MutexUnlock(&testasync_g_writerMutex);
Tcl_ExitThread(0);
TCL_THREAD_CREATE_RETURN;
}
/*
** sqlite3async_start
**
** Start a new writer thread.
*/
static int SQLITE_TCLAPI testAsyncStart(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
volatile int isStarted = 0;
ClientData threadData = (ClientData)&isStarted;
Tcl_ThreadId x;
const int nStack = TCL_THREAD_STACK_DEFAULT;
const int flags = TCL_THREAD_NOFLAGS;
int rc;
rc = Tcl_CreateThread(&x, tclWriterThread, threadData, nStack, flags);
if( rc!=TCL_OK ){
Tcl_AppendResult(interp, "Tcl_CreateThread() failed", 0);
return TCL_ERROR;
}
while( isStarted==0 ) { /* Busy loop */ }
return TCL_OK;
}
/*
** sqlite3async_wait
**
** Wait for the current writer thread to terminate.
**
** If the current writer thread is set to run forever then this
** command would block forever. To prevent that, an error is returned.
*/
static int SQLITE_TCLAPI testAsyncWait(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
int eCond;
if( objc!=1 ){
Tcl_WrongNumArgs(interp, 1, objv, "");
return TCL_ERROR;
}
sqlite3async_control(SQLITEASYNC_GET_HALT, &eCond);
if( eCond==SQLITEASYNC_HALT_NEVER ){
Tcl_AppendResult(interp, "would block forever", (char*)0);
return TCL_ERROR;
}
Tcl_MutexLock(&testasync_g_writerMutex);
Tcl_MutexUnlock(&testasync_g_writerMutex);
return TCL_OK;
}
/*
** sqlite3async_control OPTION ?VALUE?
*/
static int SQLITE_TCLAPI testAsyncControl(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
int rc = SQLITE_OK;
int aeOpt[] = { SQLITEASYNC_HALT, SQLITEASYNC_DELAY, SQLITEASYNC_LOCKFILES };
const char *azOpt[] = { "halt", "delay", "lockfiles", 0 };
const char *az[] = { "never", "now", "idle", 0 };
int iVal;
int eOpt;
if( objc!=2 && objc!=3 ){
Tcl_WrongNumArgs(interp, 1, objv, "OPTION ?VALUE?");
return TCL_ERROR;
}
if( Tcl_GetIndexFromObj(interp, objv[1], azOpt, "option", 0, &eOpt) ){
return TCL_ERROR;
}
eOpt = aeOpt[eOpt];
if( objc==3 ){
switch( eOpt ){
case SQLITEASYNC_HALT: {
assert( SQLITEASYNC_HALT_NEVER==0 );
assert( SQLITEASYNC_HALT_NOW==1 );
assert( SQLITEASYNC_HALT_IDLE==2 );
if( Tcl_GetIndexFromObj(interp, objv[2], az, "value", 0, &iVal) ){
return TCL_ERROR;
}
break;
}
case SQLITEASYNC_DELAY:
if( Tcl_GetIntFromObj(interp, objv[2], &iVal) ){
return TCL_ERROR;
}
break;
case SQLITEASYNC_LOCKFILES:
if( Tcl_GetBooleanFromObj(interp, objv[2], &iVal) ){
return TCL_ERROR;
}
break;
}
rc = sqlite3async_control(eOpt, iVal);
}
if( rc==SQLITE_OK ){
rc = sqlite3async_control(
eOpt==SQLITEASYNC_HALT ? SQLITEASYNC_GET_HALT :
eOpt==SQLITEASYNC_DELAY ? SQLITEASYNC_GET_DELAY :
SQLITEASYNC_GET_LOCKFILES, &iVal);
}
if( rc!=SQLITE_OK ){
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
return TCL_ERROR;
}
if( eOpt==SQLITEASYNC_HALT ){
Tcl_SetObjResult(interp, Tcl_NewStringObj(az[iVal], -1));
}else{
Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal));
}
return TCL_OK;
}
#endif /* SQLITE_ENABLE_ASYNCIO */
/*
** This routine registers the custom TCL commands defined in this
** module. This should be the only procedure visible from outside
** of this module.
*/
int Sqlitetestasync_Init(Tcl_Interp *interp){
#ifdef SQLITE_ENABLE_ASYNCIO
Tcl_CreateObjCommand(interp,"sqlite3async_start",testAsyncStart,0,0);
Tcl_CreateObjCommand(interp,"sqlite3async_wait",testAsyncWait,0,0);
Tcl_CreateObjCommand(interp,"sqlite3async_control",testAsyncControl,0,0);
Tcl_CreateObjCommand(interp,"sqlite3async_initialize",testAsyncInit,0,0);
Tcl_CreateObjCommand(interp,"sqlite3async_shutdown",testAsyncShutdown,0,0);
#endif /* SQLITE_ENABLE_ASYNCIO */
return TCL_OK;
}

View File

@ -59,7 +59,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
extern int Sqlitetest6_Init(Tcl_Interp*); extern int Sqlitetest6_Init(Tcl_Interp*);
extern int Sqlitetest8_Init(Tcl_Interp*); extern int Sqlitetest8_Init(Tcl_Interp*);
extern int Sqlitetest9_Init(Tcl_Interp*); extern int Sqlitetest9_Init(Tcl_Interp*);
extern int Sqlitetestasync_Init(Tcl_Interp*);
extern int Sqlitetest_autoext_Init(Tcl_Interp*); extern int Sqlitetest_autoext_Init(Tcl_Interp*);
extern int Sqlitetest_blob_Init(Tcl_Interp*); extern int Sqlitetest_blob_Init(Tcl_Interp*);
extern int Sqlitetest_demovfs_Init(Tcl_Interp *); extern int Sqlitetest_demovfs_Init(Tcl_Interp *);
@ -131,7 +130,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
Sqlitetest6_Init(interp); Sqlitetest6_Init(interp);
Sqlitetest8_Init(interp); Sqlitetest8_Init(interp);
Sqlitetest9_Init(interp); Sqlitetest9_Init(interp);
Sqlitetestasync_Init(interp);
Sqlitetest_autoext_Init(interp); Sqlitetest_autoext_Init(interp);
Sqlitetest_blob_Init(interp); Sqlitetest_blob_Init(interp);
Sqlitetest_demovfs_Init(interp); Sqlitetest_demovfs_Init(interp);

View File

@ -1,90 +0,0 @@
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: async.test,v 1.21 2009/06/05 17:09:12 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[info commands sqlite3async_initialize] eq ""} {
# The async logic is not built into this system
finish_test
return
}
rename finish_test async_really_finish_test
proc finish_test {} {
catch {db close}
catch {db2 close}
catch {db3 close}
}
if {[info exists G(isquick)]} { set ASYNC_SAVE_ISQUICK $G(isquick) }
set G(isquick) 1
set ASYNC_INCLUDE {
insert.test
insert2.test
insert3.test
lock.test
lock2.test
lock3.test
select1.test
select2.test
select3.test
select4.test
trans.test
}
# Enable asynchronous IO.
sqlite3async_initialize "" 1
# This proc flushes the contents of the async-IO queue through to the
# underlying VFS. A couple of the test scripts identified in $ASYNC_INCLUDE
# above contain lines like "catch flush_async_queue" in places where
# this is required for the tests to work in async mode.
#
proc flush_async_queue {} {
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
}
rename do_test async_really_do_test
proc do_test {name args} {
uplevel async_really_do_test async_io-$name $args
flush_async_queue
}
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
set tail [file tail $testfile]
if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue
source $testfile
# Make sure everything is flushed through. This is because [source]ing
# the next test file will delete the database file on disk (using
# [delete_file]). If the asynchronous backend still has the file
# open, it will become confused.
#
flush_async_queue
}
# Flush the write-queue and disable asynchronous IO. This should ensure
# all allocated memory is cleaned up.
set sqlite3async_trace 1
flush_async_queue
sqlite3async_shutdown
set sqlite3async_trace 0
rename do_test {}
rename async_really_do_test do_test
rename finish_test {}
rename async_really_finish_test finish_test
if {[info exists ASYNC_SAVE_ISQUICK]} { set G(isquick) $ASYNC_SAVE_ISQUICK }
finish_test

View File

@ -1,126 +0,0 @@
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: async2.test,v 1.12 2009/04/25 08:39:15 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {
[info commands sqlite3async_initialize]=="" ||
[info command sqlite3_memdebug_fail]==""
} {
# The async logic is not built into this system
puts "Skipping async2 tests: not compiled with required features"
finish_test
return
}
# Enable asynchronous IO.
set setup_script {
CREATE TABLE counter(c);
INSERT INTO counter(c) VALUES (1);
}
set sql_script {
BEGIN;
UPDATE counter SET c = 2;
CREATE TABLE t1(a PRIMARY KEY, b, c);
CREATE TABLE t2(a PRIMARY KEY, b, c);
COMMIT;
BEGIN;
UPDATE counter SET c = 3;
INSERT INTO t1 VALUES('abcdefghij', 'four', 'score');
INSERT INTO t2 VALUES('klmnopqrst', 'and', 'seven');
COMMIT;
UPDATE counter SET c = 'FIN';
}
db close
foreach err [list ioerr malloc-transient malloc-persistent] {
set ::go 10
for {set n 1} {$::go} {incr n} {
set ::sqlite_io_error_pending 0
sqlite3_memdebug_fail -1
forcedelete test.db test.db-journal
sqlite3 db test.db
execsql $::setup_script
db close
sqlite3async_initialize "" 1
sqlite3 db test.db
sqlite3_db_config_lookaside db 0 0 0
switch -- $err {
ioerr { set ::sqlite_io_error_pending $n }
malloc-persistent { sqlite3_memdebug_fail $n -repeat 1 }
malloc-transient { sqlite3_memdebug_fail $n -repeat 0 }
}
catchsql $::sql_script
db close
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
sqlite3async_shutdown
set ::sqlite_io_error_pending 0
sqlite3_memdebug_fail -1
sqlite3 db test.db
set c [db one {SELECT c FROM counter LIMIT 1}]
switch -- $c {
1 {
do_test async-$err-1.1.$n {
execsql {
SELECT name FROM sqlite_master;
}
} {counter}
}
2 {
do_test async-$err-1.2.$n.1 {
execsql {
SELECT * FROM t1;
}
} {}
do_test async-$err-1.2.$n.2 {
execsql {
SELECT * FROM t2;
}
} {}
}
3 {
do_test async-$err-1.3.$n.1 {
execsql {
SELECT * FROM t1;
}
} {abcdefghij four score}
do_test async-$err-1.3.$n.2 {
execsql {
SELECT * FROM t2;
}
} {klmnopqrst and seven}
}
FIN {
incr ::go -1
}
}
db close
}
}
catch {db close}
finish_test

View File

@ -1,76 +0,0 @@
# 2007 September 5
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# The focus of this file is testing the code in test_async.c.
# Specifically, it tests that the xFullPathname() method of
# of the asynchronous vfs works correctly.
#
# $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if { [info commands sqlite3async_initialize]=="" } {
# The async logic is not built into this system
puts "Skipping async3 tests: not compiled with required features"
finish_test
return
}
db close
sqlite3async_initialize "" 1
#set sqlite3async_trace 1
sqlite3async_start
set paths {
chocolate/banana/vanilla/file.db
chocolate//banana/vanilla/file.db
chocolate/./banana//vanilla/file.db
chocolate/banana/./vanilla/file.db
chocolate/banana/../banana/vanilla/file.db
chocolate/banana/./vanilla/extra_bit/../file.db
}
do_test async3-1.0 {
file mkdir [file join chocolate banana vanilla]
forcedelete chocolate/banana/vanilla/file.db
forcedelete chocolate/banana/vanilla/file.db-journal
} {}
do_test async3-1.1 {
sqlite3 db chocolate/banana/vanilla/file.db
execsql {
CREATE TABLE abc(a, b, c);
BEGIN;
INSERT INTO abc VALUES(1, 2, 3);
}
} {}
set N 2
foreach p $paths {
sqlite3 db2 $p
do_test async3-1.$N.1 {
execsql {SELECT * FROM abc} db2
} {}
do_test async3-1.$N.2 {
catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
} {1 {database is locked}}
db2 close
incr N
}
db close
sqlite3async_control halt idle
sqlite3async_wait
sqlite3async_control halt never
sqlite3async_shutdown
finish_test

View File

@ -1,168 +0,0 @@
# 2009 April 25
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: async4.test,v 1.4 2009/06/05 17:09:12 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# These tests only work for Tcl version 8.5 and later on Windows (for now)
#
if {$tcl_platform(platform)=="windows"} {
scan $::tcl_version %f vx
if {$vx<8.5} {
finish_test
return
}
}
if {[info commands sqlite3async_initialize] eq ""} {
# The async logic is not built into this system
finish_test
return
}
db close
# Test layout:
#
# async4.1.*: Test the lockfiles parameter.
# async4.2.*: Test the delay parameter.
do_test async4.1.1 {
sqlite3async_initialize {} 0
sqlite3async_control lockfiles
} {1}
do_test async4.1.2 {
sqlite3async_control lockfiles false
} {0}
do_test async4.1.3 {
sqlite3async_control lockfiles
} {0}
do_test async4.1.4 {
sqlite3async_control lockfiles true
} {1}
do_test async4.1.5 {
sqlite3 db test.db -vfs sqlite3async
execsql { CREATE TABLE t1(a, b, c) }
} {}
do_test async4.1.6 {
list [file exists test.db] [file size test.db]
} {1 0}
do_test async4.1.7 {
sqlite3 db2 test.db
catchsql { CREATE TABLE t2(a, b, c) } db2
} {1 {database is locked}}
do_test async4.1.8 {
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
} {}
do_test async4.1.9 {
catchsql { CREATE TABLE t2(a, b, c) } db2
} {0 {}}
do_test async4.1.10 {
list [catch {sqlite3async_control lockfiles false} msg] $msg
} {1 SQLITE_MISUSE}
do_test async4.1.11 {
db close
list [catch {sqlite3async_control lockfiles false} msg] $msg
} {1 SQLITE_MISUSE}
do_test async4.1.12 {
sqlite3async_start
sqlite3async_wait
sqlite3async_control lockfiles false
} {0}
do_test async4.1.13 {
sqlite3 db test.db -vfs sqlite3async
execsql { CREATE TABLE t3(a, b, c) } db
} {}
do_test async4.1.14 {
execsql {
CREATE INDEX i1 ON t2(a);
CREATE INDEX i2 ON t1(a);
} db2
} {}
do_test async4.1.15 {
sqlite3async_start
sqlite3async_wait
hexio_write test.db 28 00000000
execsql { pragma integrity_check } db2
} {{*** in database main ***
Page 5 is never used}}
do_test async4.1.16 {
db close
db2 close
sqlite3async_start
sqlite3async_wait
} {}
do_test async4.1.17 {
sqlite3async_control lockfiles true
} {1}
do_test async4.2.1 {
sqlite3async_control delay
} {0}
do_test async4.2.2 {
sqlite3async_control delay 23
} {23}
do_test async4.2.3 {
sqlite3async_control delay
} {23}
do_test async4.2.4 {
sqlite3async_control delay 0
} {0}
do_test async4.2.5 {
sqlite3 db test.db -vfs sqlite3async
execsql { CREATE TABLE t4(a, b) }
set T1 [lindex [time {
sqlite3async_start
sqlite3async_wait
}] 0]
sqlite3async_control delay 100
execsql { CREATE TABLE t5(a, b) }
set T2 [lindex [time {
sqlite3async_start
sqlite3async_wait
}] 0]
expr {($T1+1000000) < $T2}
} {1}
do_test async4.2.6 {
sqlite3async_control delay 0
execsql { CREATE TABLE t6(a, b) }
set T1 [lindex [time {
sqlite3async_start
sqlite3async_wait
}] 0]
expr {($T1+1000000) < $T2}
} {1}
do_test async4.2.7 {
list [catch { sqlite3async_control delay -1 } msg] $msg
} {1 SQLITE_MISUSE}
do_test async4.2.8 {
db close
sqlite3async_start
sqlite3async_wait
} {}
finish_test

View File

@ -1,68 +0,0 @@
# 2009 July 19
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file tests that asynchronous IO is compatible with multi-file
# transactions.
#
# $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[info commands sqlite3async_initialize] eq ""} {
# The async logic is not built into this system
finish_test
return
}
db close
forcedelete test2.db
sqlite3async_initialize "" 1
sqlite3async_control halt never
sqlite3 db test.db
do_test async5-1.1 {
execsql {
ATTACH 'test2.db' AS next;
CREATE TABLE main.t1(a, b);
CREATE TABLE next.t2(a, b);
BEGIN;
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t2 VALUES(3, 4);
COMMIT;
}
} {}
do_test async5-1.2 {
execsql { SELECT * FROM t1 }
} {1 2}
do_test async5-1.3 {
execsql { SELECT * FROM t2 }
} {3 4}
do_test async5-1.4 {
execsql {
BEGIN;
INSERT INTO t1 VALUES('a', 'b');
INSERT INTO t2 VALUES('c', 'd');
COMMIT;
}
} {}
do_test async5-1.5 {
execsql { SELECT * FROM t1 }
} {1 2 a b}
do_test async5-1.6 {
execsql { SELECT * FROM t2 }
} {3 4 c d}
db close
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
sqlite3async_shutdown
set sqlite3async_trace 0
finish_test

View File

@ -21,7 +21,7 @@ source $testdir/tester.tcl
# #
do_test lock-1.0 { do_test lock-1.0 {
# Give a complex pathname to stress the path simplification logic in # Give a complex pathname to stress the path simplification logic in
# the vxworks driver and in test_async. # the vxworks driver.
file mkdir tempdir/t1/t2 file mkdir tempdir/t1/t2
sqlite3 db2 ./tempdir/../tempdir/t1/.//t2/../../..//test.db sqlite3 db2 ./tempdir/../tempdir/t1/.//t2/../../..//test.db
set dummy {} set dummy {}

View File

@ -472,49 +472,6 @@ do_test main-3.6 {
catchsql {SELECT 'abc' + #9} catchsql {SELECT 'abc' + #9}
} {1 {near "#9": syntax error}} } {1 {near "#9": syntax error}}
# The following test-case tests the linked list code used to manage
# sqlite3_vfs structures.
if {$::tcl_platform(platform)=="unix"
&& [info command sqlite3async_initialize]!=""} {
ifcapable threadsafe {
do_test main-4.1 {
sqlite3_crash_enable 1
sqlite3_crash_enable 0
sqlite3async_initialize "" 1
sqlite3async_shutdown
sqlite3_crash_enable 1
sqlite3async_initialize "" 1
sqlite3_crash_enable 0
sqlite3async_shutdown
sqlite3_crash_enable 1
sqlite3async_initialize "" 1
sqlite3async_shutdown
sqlite3_crash_enable 0
sqlite3async_initialize "" 1
sqlite3_crash_enable 1
sqlite3_crash_enable 0
sqlite3async_shutdown
sqlite3async_initialize "" 1
sqlite3_crash_enable 1
sqlite3async_shutdown
sqlite3_crash_enable 0
} {}
do_test main-4.2 {
set rc [catch {sqlite3 db test.db -vfs crash} msg]
list $rc $msg
} {1 {no such vfs: crash}}
do_test main-4.3 {
set rc [catch {sqlite3 db test.db -vfs async} msg]
list $rc $msg
} {1 {no such vfs: async}}
}
}
# Print the version number so that it can be picked up by releasetest.tcl. # Print the version number so that it can be picked up by releasetest.tcl.
# #
puts [db one {SELECT 'VERSION: ' || puts [db one {SELECT 'VERSION: ' ||

View File

@ -38,8 +38,6 @@ set EXCLUDE {
misuse.test misuse.test
memleak.test memleak.test
btree2.test btree2.test
async.test
async2.test
trans.test trans.test
crash.test crash.test
autovacuum_crash.test autovacuum_crash.test

View File

@ -108,14 +108,14 @@ if {$::tcl_platform(platform)!="unix"} {
set alltests [test_set $alltests -exclude crash.test crash2.test] set alltests [test_set $alltests -exclude crash.test crash2.test]
} }
set alltests [test_set $alltests -exclude { set alltests [test_set $alltests -exclude {
all.test async.test quick.test veryquick.test all.test quick.test veryquick.test
memleak.test permutations.test soak.test fts3.test memleak.test permutations.test soak.test fts3.test
mallocAll.test rtree.test full.test extraquick.test mallocAll.test rtree.test full.test extraquick.test
session.test rbu.test session.test rbu.test
}] }]
set allquicktests [test_set $alltests -exclude { set allquicktests [test_set $alltests -exclude {
async2.test async3.test backup_ioerr.test corrupt.test backup_ioerr.test corrupt.test
corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
@ -790,7 +790,7 @@ test_suite "inmemory_journal" -description {
journal3.test 8_3_names.test shmlock.test journal3.test 8_3_names.test shmlock.test
pendingrace.test pendingrace.test
pager1.test async4.test corrupt.test filefmt.test pager2.test pager1.test corrupt.test filefmt.test pager2.test
corrupt5.test corruptA.test pageropt.test corrupt5.test corruptA.test pageropt.test
# Exclude stmt.test, which expects sub-journals to use temporary files. # Exclude stmt.test, which expects sub-journals to use temporary files.
@ -951,12 +951,11 @@ test_suite "safe_append" -description {
set ::G(perm:sqlite3_args) [list -vfs devsym] set ::G(perm:sqlite3_args) [list -vfs devsym]
sqlite3_simulate_device -char safe_append sqlite3_simulate_device -char safe_append
} -files [ } -files [
test_set $::allquicktests shared_err.test -exclude async3.test test_set $::allquicktests shared_err.test
] ]
# The set of tests to run on the alternative-pcache # The set of tests to run on the alternative-pcache
set perm-alt-pcache-testset { set perm-alt-pcache-testset {
async.test
attach.test attach.test
delete.test delete2.test delete.test delete2.test
index.test index.test
@ -997,7 +996,7 @@ test_suite "journaltest" -description {
unregister_jt_vfs unregister_jt_vfs
} -files [test_set $::allquicktests -exclude { } -files [test_set $::allquicktests -exclude {
wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test
async4.test bigfile.test backcompat.test e_wal* fstat.test mmap2.test bigfile.test backcompat.test e_wal* fstat.test mmap2.test
pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock* pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock*
pager2.test *fault* rowal* snapshot* superlock* symlink.test pager2.test *fault* rowal* snapshot* superlock* symlink.test
delete_db.test shmlock.test chunksize.test delete_db.test shmlock.test chunksize.test

View File

@ -1,72 +0,0 @@
# 2009 October 19
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[info commands sqlite3async_initialize] eq ""} {
# The async logic is not built into this system
finish_test
return
}
# Create a database.
do_test tkt-94c94-1.1 {
execsql { CREATE TABLE t1(a, b) }
} {}
# Grow the file to larger than 4096MB (2^32 bytes)
db close
if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} {
puts "**** Unable to create a file larger than 4096 MB. *****"
finish_test
return
}
# Switch to async mode.
sqlite3async_initialize "" 1
sqlite3 db test.db
sqlite3 db2 test.db
# Read from and write to the db just past the 4096MB mark.
#
do_test tkt-94c94-2.1 {
execsql { CREATE TABLE t2(x, y) } db
} {}
do_test tkt-94c94-2.2 {
execsql { INSERT INTO t2 VALUES(1, 2) } db2
} {}
do_test tkt-94c94-2.3 {
execsql { SELECT * FROM t2 } db
} {1 2}
do_test tkt-94c94-2.4 {
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
} {}
do_test tkt-94c94-2.5 {
execsql { SELECT * FROM t2 } db
} {1 2}
do_test tkt-94c94-2.6 {
sqlite3async_start
sqlite3async_wait
} {}
db close
db2 close
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
sqlite3async_shutdown
finish_test