[
https://issues.apache.org/jira/browse/CASSANDRA-4842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylvain Lebresne updated CASSANDRA-4842:
----------------------------------------
Attachment: 4842.txt
Oups, it's indeed time we fix that (it's in fact a problem for any string that
have a ':', so not only dates). Attaching a patch that makes the string
representation of composites safer. Namely, the patch escapes ':' character in
the components to know where to split correctly on fromString. There is a
slight complication if a '\' is at the end of one part, but the patch deals
with that (and hopefully handle all cases).
Unfortunately, this won't fix the getString for existing data. However since
the only time we were using fromString/getString of the comparator is in
CFDefinition.to/fromSchema, and since things used to crash right away, this is
probably not a big deal. People may have to trash/recreate their schema however
if they ran into this problem.
> DateType in Column MetaData causes server crash
> -----------------------------------------------
>
> Key: CASSANDRA-4842
> URL: https://issues.apache.org/jira/browse/CASSANDRA-4842
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.1.0
> Environment: All
> Reporter: Russell Bradberry
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 1.1.7, 1.2.0
>
> Attachments: 4842.txt
>
>
> when creating a column family with column metadata containing a date, there
> is a server crash that will prevent startup.
> To recreate from the cli:
> {code}
> create keyspace test;
> use test;
> create column family foo
> with column_type = 'Standard'
> and comparator = 'CompositeType(LongType,DateType)'
> and default_validation_class = 'UTF8Type'
> and key_validation_class = 'UTF8Type'
> and column_metadata = [
> { column_name : '1234:1350695443433', validation_class : BooleanType}
> ];
> {code}
> Produces this error in the logs:
> {code}
> ERROR 21:11:18,795 Error occurred during processing of message.
> java.lang.RuntimeException: java.util.concurrent.ExecutionException:
> org.apache.cassandra.db.marshal.MarshalException: unable to coerce
> '2012-10-19 21' to a formatted date (long)
> at
> org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:373)
> at
> org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:194)
> at
> org.apache.cassandra.service.MigrationManager.announceNewColumnFamily(MigrationManager.java:141)
> at
> org.apache.cassandra.thrift.CassandraServer.system_add_column_family(CassandraServer.java:931)
> at
> org.apache.cassandra.thrift.Cassandra$Processor$system_add_column_family.getResult(Cassandra.java:3410)
> at
> org.apache.cassandra.thrift.Cassandra$Processor$system_add_column_family.getResult(Cassandra.java:3398)
> at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
> at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
> at
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:186)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:680)
> Caused by: java.util.concurrent.ExecutionException:
> org.apache.cassandra.db.marshal.MarshalException: unable to coerce
> '2012-10-19 21' to a formatted date (long)
> at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
> at java.util.concurrent.FutureTask.get(FutureTask.java:83)
> at
> org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:369)
> ... 11 more
> Caused by: org.apache.cassandra.db.marshal.MarshalException: unable to coerce
> '2012-10-19 21' to a formatted date (long)
> at
> org.apache.cassandra.db.marshal.DateType.dateStringToTimestamp(DateType.java:117)
> at org.apache.cassandra.db.marshal.DateType.fromString(DateType.java:85)
> at
> org.apache.cassandra.db.marshal.AbstractCompositeType.fromString(AbstractCompositeType.java:213)
> at
> org.apache.cassandra.config.ColumnDefinition.fromSchema(ColumnDefinition.java:257)
> at
> org.apache.cassandra.config.CFMetaData.addColumnDefinitionSchema(CFMetaData.java:1318)
> at
> org.apache.cassandra.config.CFMetaData.fromSchema(CFMetaData.java:1250)
> at
> org.apache.cassandra.config.KSMetaData.deserializeColumnFamilies(KSMetaData.java:299)
> at
> org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:434)
> at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:346)
> at
> org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:217)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> ... 3 more
> Caused by: java.text.ParseException: Unable to parse the date: 2012-10-19 21
> at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
> at
> org.apache.cassandra.db.marshal.DateType.dateStringToTimestamp(DateType.java:113)
> ... 14 more
> ERROR 21:11:18,795 Exception in thread Thread[MigrationStage:1,5,main]
> org.apache.cassandra.db.marshal.MarshalException: unable to coerce
> '2012-10-19 21' to a formatted date (long)
> at
> org.apache.cassandra.db.marshal.DateType.dateStringToTimestamp(DateType.java:117)
> at org.apache.cassandra.db.marshal.DateType.fromString(DateType.java:85)
> at
> org.apache.cassandra.db.marshal.AbstractCompositeType.fromString(AbstractCompositeType.java:213)
> at
> org.apache.cassandra.config.ColumnDefinition.fromSchema(ColumnDefinition.java:257)
> at
> org.apache.cassandra.config.CFMetaData.addColumnDefinitionSchema(CFMetaData.java:1318)
> at
> org.apache.cassandra.config.CFMetaData.fromSchema(CFMetaData.java:1250)
> at
> org.apache.cassandra.config.KSMetaData.deserializeColumnFamilies(KSMetaData.java:299)
> at
> org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:434)
> at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:346)
> at
> org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:217)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:680)
> Caused by: java.text.ParseException: Unable to parse the date: 2012-10-19 21
> at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
> at
> org.apache.cassandra.db.marshal.DateType.dateStringToTimestamp(DateType.java:113)
> ... 14 more
> {code}
> This error is repeated when attempting to restart the server, and results in
> the server failing to start.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira