You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jon Hermes (JIRA)" <ji...@apache.org> on 2010/07/28 23:45:17 UTC

[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

     [ https://issues.apache.org/jira/browse/CASSANDRA-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Hermes updated CASSANDRA-1313:
----------------------------------

    Attachment: snakeyaml-percentToFloat.txt
                1313.txt
                snakeyaml-r1131-dev1.jar

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 hook.
* 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 destination).

I decided the best fix is to effect a change in snakeyaml as outlined above (and tracked at: http://code.google.com/p/snakeyaml/issues/detail?id=75 ).

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 1313.txt.

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 trainwreck).

> 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: https://issues.apache.org/jira/browse/CASSANDRA-1313
>             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.