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

Fix Dialyzer warnings #528

Closed
wants to merge 78 commits into from
Closed

Fix Dialyzer warnings #528

wants to merge 78 commits into from

Conversation

seancribbs
Copy link
Contributor

Getting a clean slate. Only remaining warnings may be:

Unknown functions:
  cluster_info:format/3
  cluster_info:register_app/1

Those will disappear if cluster_info is on the code path.

{legacy, _} ->
{ignore, legacy};
{error, invalid_resize_claim} ->
lager:error("invalid_resize_claim BUG");
Copy link
Contributor

Choose a reason for hiding this comment

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

this probably doesn't need to log. just surface the error to the user? or does this path not bubble back up that far...need to look...

Copy link
Contributor

Choose a reason for hiding this comment

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

ok we should be able to bubble this up to the user like so (sorry this is going to be a little verbose because im working through it as i type):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How's this?

io:format("Unable to commit staged ring changes while ring is resizing.~n"
          "Check that there are no pending changes in 'riak-admin ring-status'~n"
          "If there are, try again once they are completed,~n"
          "Otherwise try again shortly.~n");

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for the delay:

"Unable to commit staged ring changes while ring is resizing" -> "Unable to commit staged ring changes"

The issue is not that the ring is resizing but that another operation took place (e.g. unstaged join) between the plan and the commit. Not sure how to best explain that, so figure its easier just to be short.

@seancribbs
Copy link
Contributor Author

  • Revert lists:foreach into LCs which are faster, underscore match result.
  • Break out riak_core_vnode:vnode_forward.
  • Address Fix Dialyzer warnings #528 (comment)
  • Restore deleted annotations to riak_core_apl functions.

Some of these should really cause crashes when errors are returned,
since later expressions expect them to have succeeded.
Removed the related dead code.
…ported.

The case where it returns verbose information is only useful for the
test, and should probably instead be tested with EQC.
TODO: This seems like a real bug that should be addressed. Ask @jrwest
Since we expect this to succeed (some other node just asked us to
rejoin), logging an error when it doesn't seems most reasonable.
riak_core_handoff_manager.erl:392: The pattern {F, 'dynamic'} can never match the type 'undefined' | {non_neg_integer(),'bytes' | 'objects'}
riak_core_handoff_receiver.erl:25: Callback info about the riak_core_gen_server behaviour is not available
@andrewjstone
Copy link
Contributor

Yep. We definitely discussed removing that since it's covered by r_t. No
idea why it fails in particular locally. After 2-3 weeks of not touching
it, I think I'm just going to remove it.

On Sat, Feb 22, 2014 at 2:03 PM, Sean Cribbs notifications@github.comwrote:

There seems to be a race or something in this testhttps://github.com/basho/riak_core/blob/bugfix/realtalk/dialyze/src/riak_core_vnode_proxy.erl#L357-L372.
From buildbot:

riak_core_vnode_proxy: overload_test_ (should not discard in normal operation)...failed
in function riak_core_vnode_proxy:'-overload_test_/0-fun-5-'/2 (src/riak_core_vnode_proxy.erl, line 368)
**error:{assertEqual_failed,[{module,riak_core_vnode_proxy},
{line,368},
{expression,"Count"},
{expected,50001},
{value,47842}]}

Reply to this email directly or view it on GitHubhttps://github.com//pull/528#issuecomment-35811112
.

@@ -127,12 +127,7 @@ put_tag(Tag) ->
true ->
FTag = iolist_to_binary(Tag),
put(?DTRACE_TAG_KEY, FTag),
case get(?MAGIC) of
dtrace ->
dtrace:put_utag(FTag);
Copy link
Contributor

Choose a reason for hiding this comment

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

this change seems to be removing some functionality? put_utag vs. put_tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dtrace module was from Scott's patch before it was fixed-up/merged into OTP. There is no such module anymore.

@@ -325,8 +325,7 @@ handle_info({'DOWN', Mref, _, _Pid, _Info}, State) ->

%% Update our list of active services and ETS table
Services = ordsets:del_element(Id, State#state.services),
S3 = S2#state { services = Services },
local_update(S3),
S3 = local_update(S2#state { services = Services }),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is a case here where we can lose the correct state because local_update/1 may return ok [1]

[1] https://github.com/basho/riak_core/blob/bugfix/realtalk/dialyze/src/riak_core_node_watcher.erl#L487-L490

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notice that broadcast is called after the case statement in that function.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, yes. my mistake

Copy link
Contributor

Choose a reason for hiding this comment

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

Was just looking at the top of the thread, and wanted to note that you can
add -compile(inline_list_funcs). to the top to get the LC optimizations
added to standard lists module calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@evanmcc Interesting. Should we be doing that globally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, the other argument for LCs even when the return value is not used is clarity/visual noise reduction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know. It's something that I'd need to test. Maybe we can enable
it at the start of the next dev cycle so we have a long time to hopefully
run into any issues.

@@ -35,23 +35,24 @@
-include_lib("eunit/include/eunit.hrl").
-endif.

-type index() :: non_neg_integer().
-type index() :: chash:index_as_int().
-type n_val() :: non_neg_integer().
-type ring() :: riak_core_ring:riak_core_ring().
-type preflist() :: [{index(), node()}].
-type preflist2() :: [{{index(), node()}, primary|fallback}].
Copy link
Contributor

Choose a reason for hiding this comment

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

we're probably nearing the point where we should try to stop making new changes, but couldn't help but comment that i really wish this were something like preflist_ann() or annotated_preflist() rather than preflist2().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, will fix.

Sean Cribbs

On Feb 27, 2014, at 7:06 PM, Jordan West notifications@github.com wrote:

In src/riak_core_apl.erl:

@@ -35,23 +35,24 @@
-include_lib("eunit/include/eunit.hrl").
-endif.

--type index() :: non_neg_integer().
+-type index() :: chash:index_as_int().
-type n_val() :: non_neg_integer().
-type ring() :: riak_core_ring:riak_core_ring().
-type preflist() :: [{index(), node()}].
-type preflist2() :: [{{index(), node()}, primary|fallback}].
we're probably nearing the point where we should try to stop making new changes, but couldn't help but comment that i really wish this were something like preflist_ann() or annotated_preflist() rather than preflist2().


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 00086a7

true;
legacy_ring(_) ->
false.

%% @doc Upgrade old ring structures to the latest format.
Copy link
Contributor

Choose a reason for hiding this comment

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

it might be worth adding a comment to upgrade/1 and downgrade/1 as to why the functions do basically nothing. long term it would probably be nice to remove them (as any future upgrade/downgrade may work differently)

@jrwest
Copy link
Contributor

jrwest commented Feb 28, 2014

seeing some issues running verify_dynamic_ring against this branch. lots of log messages like the one below. investigating...

20:20:07.354 [error] Error: riak_core_ring/ring_ready called on tainted ring

update 1:

same issue with verify_build_cluster, in this case, the log messages are in the riak logs only.

update 2:

I think i've isolated the issue to some of the recent legacy gossip removal changes. the errors do not appear when rolling back to a5c2443

@seancribbs
Copy link
Contributor Author

Closing this in favor of a PR that excludes:

  • Changes to riak_core_security, since that changed several times during the course of this work.
  • Removal of anything related to legacy gossip, which should be separate.

@seancribbs seancribbs closed this Feb 28, 2014
This was referenced Feb 28, 2014
seancribbs added a commit that referenced this pull request Mar 1, 2014
seancribbs added a commit that referenced this pull request Mar 1, 2014
@seancribbs seancribbs deleted the bugfix/realtalk/dialyze branch March 1, 2014 23:18
@jrwest jrwest mentioned this pull request Mar 24, 2014
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.

7 participants