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

Improve MR Error Messages (AZ935) #252

Merged
merged 7 commits into from
Dec 12, 2011
Merged

Improve MR Error Messages (AZ935) #252

merged 7 commits into from
Dec 12, 2011

Conversation

beerriot
Copy link

This PR "improves" MapReduce error messages.

At the moment, "improves" means, "gets more information out in the HTTP response." I'm interested in feedback about whether or not this is the right information to expose, and whether or not it's exposed in a useful format. If both aspects are +1, similar changes should also be made to the PB response.

Side note: There was early discussion about translating errors like bad_encoding to more verbose English like "The input contained bytes that were not valid UTF-8 characters." This was dropped in favor of just changing the error atom to bad_utf8_character_code to keep things simpler. The new atom should be descriptive, yet unique enough to describe further in other Google-reachable contexts, like the wiki.

it's ugly string-formatted versions of the data that's actually there,
but it's better than nothing
AZ935

Before this patch, the error tuple would be passed to invoke_js,
producing a function clause error in js_driver later.  With this patch,
the bad_encoding error is returned to the caller correctly.
much more descriptive, and in-line with what's happening underneath
@beerriot
Copy link
Author

I suppose some hints for triggering errors that render these messages might have been helpful…

This one triggers an error in an erlang function if the given bucket/key does not exist:

curl -X POST -H "Content-type: application/json" http://localhost:8098/mapred --data @-
{"inputs":[["none","here"]],"query":[{"map":{"language":"erlang","module":"riak_kv_mapreduce","function":"map_object_value"}}]}

Triggering an error in JSON encoding, due to bad UTF8, takes two steps. First, upload a file of random, likely invalid-UTF8 bytes:

dd count=1 if=/dev/urandom | curl -X PUT -H "content-type: application/octet-stream" http://localhost:8098/riak/bin/rand --data-binary @-

Then run a JS map on it:

curl -X POST -H "Content-type: application/json" http://localhost:8098/mapred --data @-
{"inputs":[["bin","rand"]],"query":[{"map":{"language":"javascript","source":"function(v) { return [v]; }"}}]}

Catching errors here hides failures from HTTP and PB clients.  Removing
the catch means that MR queries stop immediately on reduce failure, just
like they do with map failures.
@beerriot
Copy link
Author

beerriot commented Dec 1, 2011

This small addition allowed all of this new error-returning stuff to work for reduce phases as well. Previously, when a reduce phase encountered an error, it would try reprocessing its inputs when it received more inputs. If the error still happened on the last input, the phase would end up passing its inputs onward as outputs, rather than raising the error to the user (https://issues.basho.com/show_bug.cgi?id=1185). The new behavior raises the error and fails immediately.

the error should say "non_list_result"
to catch bad_json as well, and to avoid a 'bad_return_value' being sent
to the client, instead of the real error
@russelldb
Copy link
Member

Pulled, ran. tested, played the az935 game, read, understood, +1'd

PB error message is now a JSON object
@russelldb
Copy link
Member

Pulled the latest, ran, read, +1ing

@beerriot beerriot merged commit 642a927 into master Dec 12, 2011
@tovbinm
Copy link

tovbinm commented Mar 9, 2012

How to solve "bad_utf8_character_code" error returned by Riak MR?

@beerriot
Copy link
Author

beerriot commented Mar 9, 2012

@tovbinm Javascript phases require that all inputs to them be valid UTF8. For map phases, this means that the value stored in your Riak object, as well as its bucket and key, must be valid UTF8. If you're getting a bad_utf8_character_code then the data you're passing to Javascript contains a string or binary that is not valid UTF8.

@tovbinm
Copy link

tovbinm commented Mar 9, 2012

Got it.

What about "application/binary" values?

Why do I get the same error even in case when my map function is simple like this "function map () { return [1]; }" ?
I was hoping is this case values will not be read.

@beerriot
Copy link
Author

beerriot commented Mar 9, 2012

Could we please move this discussion to the mailing list? There are more people watching, ready to help, and interested in the discussion there.

@tovbinm
Copy link

tovbinm commented Mar 9, 2012

Sure. Thanks for your help!

@seancribbs seancribbs deleted the az935-error-msgs branch April 1, 2015 23:23
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.

3 participants