cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Hermes (JIRA)" <>
Subject [jira] Updated: (CASSANDRA-1313) make cache sizes in CfDef Strings again so we can use %s of rows in the CF as in 0.6
Date Wed, 28 Jul 2010 21:45:17 GMT


Jon Hermes updated CASSANDRA-1313:

    Attachment: snakeyaml-percentToFloat.txt

Simply making \{rows,keys\}_cached strings instead of doubles is problematic. The current
code looks for 'double \{rows,keys\}_cached', and changing every lookup is a non-trivial chunk
of code. The lookup would also take extra cycles (or just two extra cycles if the first lookups
cache the String->Double operation).

Loading a String into a Double from the YAML using snakeyaml directly has proven difficult:
* Getters and setters on the Config/RawKS/RawCF beans are never called, so there is no immediate
* Telling the constructor in DD that "50%" should be a double does not help the constructor
parse the string into a double -- snakeyaml explodes.
* Pushing the values into a String on the bean, then populating the double from the string
leaves extra variables around. Also, these extra variables have to be named something different
than \{rows,keys\}_cached, which means extra work in our 0.6->0.7 Converter.
* Pushing the values into a String on a FooConfig, then generating Config from FooConfig works,
but means two passes on the load and hard to maintain later. 
* *Finally,* change the snakeyaml code directly. Whenever it sees a number followed by a percent,
it should correctly construct a FloatType (be it Float, Double, or BigDecimal according to

I decided the best fix is to effect a change in snakeyaml as outlined above (and tracked at: ).

Attached are 3 things:
- The patch to snakeyaml trunk, named snakeyaml-percentToFloat.txt,
- The lib built from trunk after patch applied, named snakeyaml-r1131-dev1.jar,
- and a patch for C trunk (changes conf/cassandra.yaml and test/conf/cassandra.yaml), named

With this, the values legal for \{rows,keys\}_cached is a literal (1000, 0.5, 0) or a string
("1000", "50%", "0%"). As before, a value between [0,1] is a fraction of the total, and all
larger values are absolute. Because this is a change to the parser, you can also give percents
anywhere else a double is expected (read_repair_chance: '72.25%' if you want).

Should this change not be accepted, one of the above methods can be employed in our code,
or I can override-in all the functionality of the patch (though the code will look like a

> make cache sizes in CfDef Strings again so we can use %s of rows in the CF as in 0.6
> ------------------------------------------------------------------------------------
>                 Key: CASSANDRA-1313
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.7 beta 1
>            Reporter: Jonathan Ellis
>            Assignee: Jon Hermes
>             Fix For: 0.7 beta 1
>         Attachments: 1313.txt, snakeyaml-percentToFloat.txt, snakeyaml-r1131-dev1.jar

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message