basho / cuttlefish

never lose your childlike sense of wonder baby cuttlefish, promise me?
Apache License 2.0
205 stars 124 forks source link

Multi backend configuration crash #95

Closed liveforeverx closed 10 years ago

liveforeverx commented 10 years ago

Hi, I don't know, where is better to address this issue, on riak or on cuttlefish.

I have used riak, branch develop, after compiling a release with make rel.

If I add the configuration to the riak like this:

storage_backend = multi

multi_backend.bitcask_mult.storage_backend = bitcask
multi_backend.leveldb_mult.storage_backend = leveldb

Then I get the after compiling riak with make rel this error:

# bin/riak console
Error generating config with cuttlefish

Without any information whats going wrong.

The stacktrace for the problem is:

error:badarg
[{erlang,list_to_atom,[-1],[]},
 {cuttlefish_datatypes,from_string,2,
                       [{file,"src/cuttlefish_datatypes.erl"},{line,134}]},
 {cuttlefish_generator,transform_supported_type,4,
                       [{file,"src/cuttlefish_generator.erl"},{line,412}]},
 {cuttlefish_generator,transform_extended_type,4,
                       [{file,"src/cuttlefish_generator.erl"},{line,431}]},
 {cuttlefish_generator,'-transform_datatypes/2-fun-3-',3,
                       [{file,"src/cuttlefish_generator.erl"},{line,370}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1248}]},
 {cuttlefish_generator,map_transform_datatypes,2,
                       [{file,"src/cuttlefish_generator.erl"},{line,59}]},
 {cuttlefish_escript,engage_cuttlefish,1,
                     [{file,"src/cuttlefish_escript.erl"},{line,301}]}]
seancribbs commented 10 years ago

Does the problem go away when you switch to straight bitcask or leveldb?

liveforeverx commented 10 years ago

Yes.

If I add only this line, it working too:

storage_backend = multi

Adding this line already caused this crash:

multi_backend.bitcask_mult.storage_backend = bitcask
seancribbs commented 10 years ago

@liveforeverx Thanks, which version are you running?

liveforeverx commented 10 years ago

riak, branch develop, latest commit: cuttlefish-0.1.0-131-gbe3e808

seancribbs commented 10 years ago

@liveforeverx What's the sha of the riak_kv dependency?

liveforeverx commented 10 years ago

@seancribbs, riak_kv-1.4.2-446-ga073f22

liveforeverx commented 10 years ago

@seancribbs I'll try to find more:

It happens for this variable

["multi_backend","bitcask_mult","bitcask","expiry"]
["multi_backend","leveldb_mult","bitcask","expiry"]

with this value:

-1

Seems, that it configured to be an atom

(<0.87.0>) call cuttlefish_generator:transform_type([{atom,off},{duration,s}],-1)

I'll try to check, if it so.

If I set for every backend (as quick fix) the off value, it working:

multi_backend.bitcask_mult.storage_backend = bitcask
multi_backend.leveldb_mult.storage_backend = leveldb
multi_backend.bitcask_mult.bitcask.expiry = off
multi_backend.leveldb_mult.bitcask.expiry = off

And it comming as a default value false, but I can't find, where it will set:

 {["multi_backend","memory_mult","bitcask","expiry"],-1},
 {["multi_backend","leveldb_mult","bitcask","expiry"],-1},
 {["multi_backend","bitcask_mult","bitcask","expiry"],-1},
 {["bitcask","expiry"],off}
liveforeverx commented 10 years ago

Seems, that default is configured false, if it so, please close the issue

{mapping, "multi_backend.$name.bitcask.expiry", "riak_kv.multi_backend", [
  {datatype, [{atom, off}, {duration, s}]},
  {level, advanced},
  {default, off}
]}.
seancribbs commented 10 years ago

@liveforeverx This is a genuine bug. When you supply "off" in the config, it translates to -1 in the Erlang side. Not sure how to resolve it yet though. @joedevivo Thoughts?

seancribbs commented 10 years ago

Woops, looks like you fixed it already, thanks for the PR!