Skip to content

Extract Protocol Buffers interface from KV#321

Merged
rzezeski merged 6 commits into
masterfrom
sdc-pbc-extract
Jun 5, 2012
Merged

Extract Protocol Buffers interface from KV#321
rzezeski merged 6 commits into
masterfrom
sdc-pbc-extract

Conversation

@seancribbs

Copy link
Copy Markdown
Contributor

This is part of a series of pull-requests to extract the Protocol Buffers interface from riak_kv and make it available to all applications in an unobtrusive manner.

Related: basho/riak#138

This pull-request extracts riak_kv_pb_socket functionality into 3 individual services implementing the riak_api_pb_service behaviour -- riak_kv_pb_object, riak_kv_pb_bucket, and riak_kv_pb_mapred. The "ping" and "server_info" requests were moved to the riak_api application.

Additionally, review of the riak_api application and its design is requested.

@kellymclaughlin

Copy link
Copy Markdown
Contributor

Editorial comment: really awesome to see the monstrosity of riak_kv_pb_socket broken up

@kellymclaughlin

Copy link
Copy Markdown
Contributor

What about some lager output here in the case that a user is upgrading and uses an old config. I actually did just that and the error when the riak_api section is missing is non-obvious.

Comment thread src/riak_kv_pb_bucket.erl

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.

Is it worth a comment here indicating that this is a generated file to avoid any confusion? I'm not certain it is, just a thought.

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.

In the past we haven't, but the deps should work out so that the header is generated before riak_kv is compiled.

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

Is it just me, or did the rpbgetserverinforeq disappear?

@seancribbs

Copy link
Copy Markdown
Contributor Author

@rzezeski It has moved to riak_api.

Comment thread src/riak_kv_pb_object.erl

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.

Maybe call this decode_vc to be more consistent with other changes? (and pbify_rpbvc to encode_vc)

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

I see a lot of failures with the Java client integration tests on a devrel. The entries in the crash.log aren't helping much as they just show the incoming message and {error, function_clause}. Currently master of riak is broken because the PB work is half merged (which I take full responsibility for). I'd like to get this wrapped up today so master will build again.

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

I discovered what the problem is after tracing at debug level on the riak_api_pb_server. I don't like that we catch errors and then only show stack if debug level is set. This means that when a customer encounters an error like this we have to show them how to use debug level tracing so we an see the actual exception. I say all those debugs should be logged with at error. Or at least return the stacktrace along with the reason so the logs aren't useless.

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

The new decode_quorum slightly breaks old behavior of normalize_mumble. The old function did not have a guard to check that argument is integer. Please revert to old logic for now so things don't break.

@seancribbs

Copy link
Copy Markdown
Contributor Author

@rzezeski Early feedback from @jonmeredith indicated that a frequently failing client would spam the logs, hence the level was lowered to debug from info. Also, the client should receive the error message in an rpberrorresp, although i admit it's not as useful as a full backtrace. Again, the desire here is to warn the client before stopping abruptly so the error can at least go through the client error handling logic.

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

The problem is that what is returned to the client is useless. Either the stack needs to be formatted with it or we need to change from debug->error (it's an error, lets log it as one).

catch
    %% Tell the client we errored before closing the connection.
    Type:Failure ->
        lager:debug("Message processing error: ~p:~p ~p", [Type, Failure, erlang:get_stacktrace()]),
        send_error("Error processing incoming message: ~p:~p", [Type, Failure], State),
        {stop, {Type, Failure}, State}
end

@rzezeski

rzezeski commented Jun 5, 2012

Copy link
Copy Markdown
Contributor

I've reviewed this code, compiled it, ran unit tests, and most of the Java client integration tests are running. I'm going to merge this in master so that it builds again and file issues for remaining failures.

@rzezeski
rzezeski merged commit d38af7b into master Jun 5, 2012
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.

3 participants