Commit 6245ac6
committed
Reclaim freed SQLite filesystem space
When data is removed from a SQLite database, pages are marked as free
instead of being release back to the OS / filesystem. Consequently, when
an app uses a lot of IndexedDB space at some point in time, even if the
database contents are deleted afterwards, the database file size will
remain with the max size so far. This can cause filesystem space to get
exhausted in constrained environments where small volume sizes are used
for storage.It can also cause issues with the database operations when
full volume capacity was reached (e.g. multiple domains, local storage
usage) despite not using the full "real" quota and WAL is being used.
These changes attempt to mitigate this issue by running the incremental
auto vacuum whenever some amount of free space is available to be
released. This is currently done on database open. While not ideal, as
there is no guarantee that the database will be opened again to free
that space, there is also no guarantee that the database close method
( SQLiteIDBBackingStore::close() ) will be invoked in all cases. The
cleanup can also not be run in sqlite hooks, as it would not be safe
due potential conflict with ongoing transactions.
The changes also contain a fix for the incremental vacuum operation
itself, as it was not being correctly performed and was returning an
error when it would actually succeed.1 parent 5e2a97e commit 6245ac6
3 files changed
Lines changed: 33 additions & 1 deletion
File tree
- Source/WebCore
- Modules/indexeddb/server
- platform/sql
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
988 | 988 | | |
989 | 989 | | |
990 | 990 | | |
| 991 | + | |
991 | 992 | | |
992 | 993 | | |
993 | 994 | | |
| |||
1036 | 1037 | | |
1037 | 1038 | | |
1038 | 1039 | | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1039 | 1044 | | |
1040 | 1045 | | |
1041 | 1046 | | |
| |||
2843 | 2848 | | |
2844 | 2849 | | |
2845 | 2850 | | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
2846 | 2867 | | |
2847 | 2868 | | |
2848 | 2869 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
544 | 552 | | |
| 553 | + | |
545 | 554 | | |
546 | 555 | | |
547 | 556 | | |
| |||
0 commit comments