Hi sqlite experts,

I am using sqlite back up API of the latest sqlite version. I find an issue 
that the target database seems not shrink when the source shrinks.

Here are my steps:

The source database is an in-memory database

  1.  Open the source database and preserve the connection for later reuse. The 
subsequent back-up operations always reuses this connection.
  2.  Create a table within the source database and insert millions of records 
into the table.
  3.  Back-up the source database to disk. Verify that the database on disk 
contains the correct data inserted just now. Also verify that the size of the 
target database is now about 200M.
  4.  Delete all the data from the source database
  5.  Start back-up again. When back-up finishes, verify that the target 
database contains no data. However, the size of it is still 200M.

By the way, my back-up logic is copied from "Example 2: Online Backup of a 
Running Database? from https://www.sqlite.org/backup.html

Is it a bug, a known issue? I believe the size of the target database should be 
kept consistent with the source database. Otherwise, quite lots of disk space 
will be wasted in case source database shrinks.


Thanks

Reply via email to