deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

Database: "Failed to run incremental vacuum"

Open gerryfrancis opened this issue 1 year ago • 1 comments

  • Operating System (Linux/Mac/Windows/iOS/Android): Android 12.

  • Delta Chat Version: 1.31.0 (nightly build of 2022-07-15).

  • Expected behavior: No error message Failed to run incremental vacuum logged.

  • Actual behavior: Error message Failed to run incremental vacuum logged.

  • Steps to reproduce the problem: N/A (unknown).

  • Screenshots: N/A.

  • Logs: deltachat-log-20220722-210310_2.txt

  • Remark: The error appeared while housekeeping was still active, see log for details.

gerryfrancis avatar Jul 22 '22 22:07 gerryfrancis

the error in the log is at sql.rs:666 - the number of the beast! coincidence? :)

r10s avatar Jul 22 '22 22:07 r10s

Maybe fixed by #2955, need to test.

link2xt avatar Feb 15 '23 22:02 link2xt

Still not fixed by #2955.

There is no documentation saying it returns anything: https://www.sqlite.org/pragma.html#pragma_incremental_vacuum Maybe need to look into the code then and see what is going on there.

link2xt avatar Mar 15 '23 20:03 link2xt

https://www.sqlite.org/c3ref/data_count.html has an interesting sentence: "The sqlite3_data_count(P) routine returns 0 if the previous call to sqlite3_step(P) returned SQLITE_DONE. The sqlite3_data_count(P) will return non-zero if previous call to sqlite3_step(P) returned SQLITE_ROW, except in the case of the PRAGMA incremental_vacuum where it always returns zero since each step of that multi-step pragma returns 0 columns of data."

Apparently incremental_vacuum is a "multi-step pragma" that returns 0 columns on each step. So we need to call sqlite3_step on it until it is done.

link2xt avatar Mar 15 '23 21:03 link2xt

Made a fix: #4160

There is almost no documentation, but the implementation explicitly generates a zero-column row.

link2xt avatar Mar 15 '23 21:03 link2xt

Works fine now, thank you so much! :)

gerryfrancis avatar Mar 16 '23 11:03 gerryfrancis