basho / riak_pipe

Riak Pipelines
Apache License 2.0
162 stars 60 forks source link

Fix race-condition around code loading. #38

Closed seancribbs closed 12 years ago

seancribbs commented 12 years ago

When parallel map-reduce jobs are invoked on a fresh node, they may try to invoke code:load/1 at the same time, one of them receiving {module, Module} and one receiving {error, not_purged}, which bubbles back to the client through the error clause. Example error from riak_kv as seen in the Ruby client builds:

Phase {kvget_map,0}: module must be a valid module name (failed to load riak_kv_pipe_get: not_purged)

Since the code already being loaded is not an error, really, matching on the not_purged clause resolves this issue.

beerriot commented 12 years ago

Could I trouble you for a small comment in the code about why this is an ok case, please, just so a future maintainer (or someone that runs into this in another trouble case) isn't completely lost?

Vagabond commented 12 years ago

Looks good and makes sense. It also makes the ruby test pass. +1

seancribbs commented 12 years ago

@Vagabond So that means you got them working? Yay.