cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Motta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-14374) Speculative retry parsing breaks on non-english locale
Date Tue, 10 Apr 2018 20:32:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-14374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16432918#comment-16432918
] 

Paulo Motta commented on CASSANDRA-14374:
-----------------------------------------

{quote}Because the previous patch introduced a minor annoying regression, in that 99p for
example is being serialized as 99.00p (instead of 99p). And check it in pt_BR locale as well
as en_US?
{quote}
Even if we use a {{DateFormatter}} we still need to specify the US locale to ensure the dot
decimal separator (and not comma) is used, so I changed the toString to:
{code:none}
return String.format("%sp", new DecimalFormat("#.####", new DecimalFormatSymbols(Locale.ENGLISH)).format(percentile));
{code}
I also updated the {{SpeculativeRetryParseTest}} to test round trip parsing with the Brazilian
locale which uses comma as the decimal separator. Patch is attached.

> Speculative retry parsing breaks on non-english locale
> ------------------------------------------------------
>
>                 Key: CASSANDRA-14374
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14374
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Paulo Motta
>            Assignee: Paulo Motta
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: 0001-Use-Locale.US-on-PercentileSpeculativeRetryPolicy.to.patch,
0002-Use-Locale.US-on-PercentileSpeculativeRetryPolicy.to.patch
>
>
> I was getting the following error when running unit tests on my machine:
> {code:none}
> Error setting schema for test (query was: CREATE TABLE cql_test_keyspace.table_32 (a
int, b int, c text, primary key (a, b)))
> java.lang.RuntimeException: Error setting schema for test (query was: CREATE TABLE cql_test_keyspace.table_32
(a int, b int, c text, primary key (a, b)))
> 	at org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:819)
> 	at org.apache.cassandra.cql3.CQLTester.createTable(CQLTester.java:632)
> 	at org.apache.cassandra.cql3.CQLTester.createTable(CQLTester.java:624)
> 	at org.apache.cassandra.cql3.validation.operations.DeleteTest.testDeleteWithNonoverlappingRange(DeleteTest.java:663)
> Caused by: org.apache.cassandra.exceptions.ConfigurationException: Specified Speculative
Retry Policy [99,00p] is not supported
> 	at org.apache.cassandra.service.reads.SpeculativeRetryPolicy.fromString(SpeculativeRetryPolicy.java:135)
> 	at org.apache.cassandra.schema.SchemaKeyspace.createTableParamsFromRow(SchemaKeyspace.java:1006)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchTable(SchemaKeyspace.java:981)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchTables(SchemaKeyspace.java:941)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:900)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspaces(SchemaKeyspace.java:1301)
> 	at org.apache.cassandra.schema.Schema.merge(Schema.java:608)
> 	at org.apache.cassandra.schema.MigrationManager.announce(MigrationManager.java:425)
> 	at org.apache.cassandra.schema.MigrationManager.announceNewTable(MigrationManager.java:239)
> 	at org.apache.cassandra.schema.MigrationManager.announceNewTable(MigrationManager.java:224)
> 	at org.apache.cassandra.schema.MigrationManager.announceNewTable(MigrationManager.java:204)
> 	at org.apache.cassandra.cql3.statements.CreateTableStatement.announceMigration(CreateTableStatement.java:88)
> 	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.executeInternal(SchemaAlteringStatement.java:120)
> 	at org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:814)
> {code}
> It turns out that my machine is configured with {{pt_BR}} locale, which uses comma instead
of dot for decimal separator, so the speculative retry option parsing introduced by CASSANDRA-14293,
which assumed {{en_US}} locale was not working.
> To reproduce on Linux:
> {code:none}
> export LC_CTYPE=pt_BR.UTF-8
> ant test -Dtest.name="DeleteTest"
> ant test -Dtest.name="SpeculativeRetryParseTest"
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message