Skip to content

Bugfix: prune user buckets#812

Merged
reiddraper merged 5 commits intorelease/1.4from
bugfix/prune-user-buckets
Feb 20, 2014
Merged

Bugfix: prune user buckets#812
reiddraper merged 5 commits intorelease/1.4from
bugfix/prune-user-buckets

Conversation

@reiddraper
Copy link
Copy Markdown
Contributor

Fixes #798.

This was previously hardcoded to 24-hours. This allows the pruning time
to be runtime (and startup) configurable. This can help in cases where
the are frequent partitions, or frequent deletion of buckets.
riak_cs_utils:fetch_user was returning the wrong boolean for
`KeepDeleted` buckets. This meant that buckets were being pruned in the
opposite scenario from when they should. This change also prunes buckets
even when there are no siblings.
@shino shino added this to the 1.4.5 milestone Feb 20, 2014
@shino shino added the Bug label Feb 20, 2014
@kuenishi
Copy link
Copy Markdown
Contributor

  • r_t
  • test / pulse
  • xref
  • dialyzer
  • review

Comment thread src/riak_cs_config.erl Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pos_integer() instead of integer() like above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 908f373.

@kuenishi
Copy link
Copy Markdown
Contributor

Also I would suggest improving spec of fetch_user/1 to:

-spec fetch_user(KeyId::binary(), pid()) ->
                        {ok, {riakc_obj(), ShouldKeepDeletedBuckets::boolean()}} |
                        {error, term()}.

For clearer understanding and preventing misuse of boolean.

@kuenishi
Copy link
Copy Markdown
Contributor

Looks like this also fixes #799. riak_cs_storage:sum_user/2 also uses get_user.

@kuenishi
Copy link
Copy Markdown
Contributor

+1 to merge regardless of above nitpick comments. Also confirmed that creating bucket after deleting another bucket removes old deleted bucket.

Eventually we'd add riak_test about this?

Comment thread src/riak_cs_utils.erl Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for stepping in and I don't execute this fix ...
timer:now_diff/2 returns time interval in micro seconds and riak_cs_config:user_buckets_prune_time() seems to be represented by seconds. Any mismatch??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! Fixed in 3ffac5d.

This fixes a bug where seconds were used to compare with microseconds.
This would cause deleted buckets to be pruned two orders of magnitude
before they were supposed to.
@reiddraper
Copy link
Copy Markdown
Contributor Author

  • Docs/specs addressed in 908f373.
  • Microsecond mixup addressed in 3ffac5d.

@reiddraper
Copy link
Copy Markdown
Contributor Author

I'm re-running all tests now.

@reiddraper
Copy link
Copy Markdown
Contributor Author

Eventually we'd add riak_test about this?

Yes. I'd like to try and think of a way of testing it that doesn't resort to timer:sleep/1, but maybe that's what we have to do?

@andrewjstone
Copy link
Copy Markdown
Contributor

code changes look good. dialyzer is clean regarding changes. tests running now.

@andrewjstone
Copy link
Copy Markdown
Contributor

👍

reiddraper added a commit that referenced this pull request Feb 20, 2014
@reiddraper reiddraper merged commit cb3e606 into release/1.4 Feb 20, 2014
@reiddraper reiddraper deleted the bugfix/prune-user-buckets branch February 20, 2014 19:32
@kuenishi
Copy link
Copy Markdown
Contributor

+1, yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants