On Tue, 6 Feb 2018 19:33:10 -0700 (MST), Nick <haveagoodtime2...@gmail.com> wrote:
>> (a) an error result of some kind or (b) a corrupt database. > > I did not see any info about errmsg. Your code doesn't check the returncode of the sqlite3_* calls. >> Are your processes using the same database connection or does each one >> have its own ? > > Two processes have two sqlite3_open(). So each one has its own. > >> Are you checking the result codes returned by all the API calls ? > > Yes. I use speedtest1.c as model code. > speedtest1_exec("BEGIN"); > speedtest1_prepare("INSERT INTO t1 VALUES(?1,?2,?3); -- %d times", > n); > for(i=1; i<=n; i++){ > rc = sqlite3_bind_int64(g.pStmt, 1, i); > rc = sqlite3_bind_int(g.pStmt, 2, i); > rc = sqlite3_bind_text(g.pStmt, 3, "hello", -1, SQLITE_STATIC); > speedtest1_run(); > } > speedtest1_exec("COMMIT"); > > And I have checked rc = SQLITE_OK. I assume speedtest1_run() calls sqlite3_step(), but does it check the return code? I suspect _step() returns SQLITE_BUSY sometimes. > >> Can you reliably get less than 20000 rows ? > > Yes, always less than 20000. > Process A inserts 1-10000 and process B inserts 10001-20000. I found that > the first few rows is missing in the result. I mean there is no 10001-10xxx. > >> Does the problem go away if you use threadsafe = 2 ? > > The problem is still here. Because the test uses two processes, every process is single-threaded, no risc of concurrency between threads. PRAGMA busy_timeout might be helpful. -- Regards, Kees Nuyt _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users