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

Add Compaction Logging #515

Merged
merged 1 commit into from
May 31, 2017
Merged

Add Compaction Logging #515

merged 1 commit into from
May 31, 2017

Conversation

tonysun83
Copy link
Contributor

@tonysun83 tonysun83 commented May 11, 2017

To predict future compaction results, we log pre-compaction and
post-compaction file sizes. These log results will be used as data
points for regression analysis.

COUCHDB-3417

Overview

Users sometimes want to know the results of compaction and how much disk space will be freed up. Unfortunately, using simply data size and disk size to calculate this prediction is misleading due to conflicts and attachments. This approach logs disk size pre and post compaction for db and view shard files. The hope is that with enough data points, users can run regression analysis to heuristically determine a compaction result.

Testing recommendations

To see the output, one can connect to a node and run compaction on db or view to see the log result.
{ok, Db} = couch_db:open(<<"shards/00000000-1fffffff/mydb.1494471596">>, []).
couch_db:start_compact(Db).

JIRA issue number

COUCHDB-3417

Related Pull Requests

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
  • I will not forget to update rebar.config.script
    with the correct commit hash once this PR get merged.

Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

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

Three tweaks:

Don't report the file name twice, the extra copy with .compact appended isn't going to be useful.
Change your format to something like "Compaction swap for db ~s ~p ~p" so that its easier to parse.
Also might want to bump this to notice level since it seems more important than info.

@tonysun83
Copy link
Contributor Author

@davisp : made the changes you suggested

[notice] 2017-05-11T16:56:25.382380Z [email protected] <0.1945.0> -------- Compaction swap for view /Users/tonysun/github/apache/couchdb/dev/lib/node1/data/.shards/00000000-1fffffff/testdb.1494473014_design/mrview/f39a9b2d4ad85d129c9a9b6d0018bb36.view 8296 4200

[notice] 2017-05-11T16:59:19.584582Z [email protected] <0.826.0> -------- Compaction swap for db: /Users/tonysun/github/apache/couchdb/dev/lib/node1/data/shards/00000000-1fffffff/mydb.1494471596.couch 49305 16537

Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

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

+1

@davisp
Copy link
Member

davisp commented May 22, 2017

@tonysun83 Any reason you haven't merged this?

@tonysun83
Copy link
Contributor Author

@davisp: wups got lost in the clutter, will do that today

To predict future compaction results, we log pre-compaction and
post-compaction file sizes. These log results will be used as data
points for regression analysis.

COUCHDB-3417
@tonysun83 tonysun83 force-pushed the 3417-add-compaction-logging branch from ee22bb6 to 0b4ef0d Compare May 31, 2017 22:22
@tonysun83 tonysun83 merged commit 0b4ef0d into master May 31, 2017
@tonysun83 tonysun83 deleted the 3417-add-compaction-logging branch July 17, 2017 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants