HomePhabricator

Add "bin/storage optimize" to run OPTIMIZE TABLE on everything

Description

Add "bin/storage optimize" to run OPTIMIZE TABLE on everything

Summary:
Even with innodb_file_per_table enabled, individual table files on disk don't normally shrink.

For most tables, like maniphest_task, this is fine, since the data in the table normally never shrinks, or only shinks a tiny amount.

However, some tables (like the "worker" and "daemon" tables) grow very large during a huge import but most of the data is later deleted by garbage collection. In these cases, this lost space can be reclaimed by running OPTIMIZE TABLE on the tables.

Add a script to OPTIMIZE TABLE every table.

My primary goal here is just to reduce storage pressure on db001 since there are a couple of "import the linux kernel" installs on that host wasting a bunch of space. We're not in any trouble, but this should buy us a good chunk of headroom.

Test Plan: Ran bin/storage optimize locally and manually ran OPTIMIZE TABLE in production, saw tables get optimized.

Reviewers: chad

Reviewed By: chad

Subscribers: cspeckmim

Differential Revision: https://secure.phabricator.com/D17640

Details

Provenance
epriestleyAuthored on Apr 8 2017, 5:23 PM
epriestleyPushed on Apr 8 2017, 10:15 PM
Reviewer
chad
Differential Revision
D17640: Add "bin/storage optimize" to run OPTIMIZE TABLE on everything
Parents
rP7707685733d2: Fix two strings with missing pht()
Branches
Unknown
Tags
Unknown
Build Status
Buildable 16355
Build 21748: Run Core Tests