MB-7825: Support compaction

- support compact for both database and index
- compact for database only
- compact for view only

Change-Id: I14586cb09b5d5b7702478ccb2084cbbe88927f4a