Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run VACUUM command to free disc space #702

Merged
merged 1 commit into from
Oct 9, 2019
Merged

Conversation

davalb
Copy link

@davalb davalb commented Oct 8, 2019

I noticed that the size of debug_kit.sqlite will keep growing even though the RequestsTable has a garbage collection implemented.

After some research (https://stackoverflow.com/questions/35787220/sqlite-file-size-not-decreasing-after-deleting-some-rows-from-database-in-ios and https://sqlite.org/lang_vacuum.html) I found out that disc space is not automatically freed. It is only freed if the database is recreated with the VACUUM; command.

@davalb davalb force-pushed the vacuum branch 2 times, most recently from 653f8dc to 2ef2c3b Compare October 8, 2019 12:48
@davalb
Copy link
Author

davalb commented Oct 8, 2019

Wait a sec, I just had the thought, what if somebody doesn't use sqllite? the VACUUM command might lead to an error in other database-engines. I believe I need to check what database-engine is used, before runnign VACUUM. Sorry for the trouble

@@ -108,5 +108,10 @@ public function gc()

$statement = $query->execute();
$statement->closeCursor();

$conn = $this->getConnection();
if (is_a($conn->getDriver(), 'Cake\Database\Driver\Sqlite')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally use instanceof instead of is_a

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I changed that!

@markstory markstory merged commit 684016c into cakephp:master Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants