Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Issues with Selecting Deleted (tombstoned) Columns #26
Comments
ghost
assigned
nberardi
May 11, 2012
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
nberardi
May 11, 2012
Contributor
Can you provide a Test or a stacktrace for this issue? You can see how I am creating tests for bugs here. https://github.com/managedfusion/fluentcassandra/blob/master/test/FluentCassandra.Tests/Bugs/Issue25JavaBigDecimalBinaryConversion.cs
Can you provide a Test or a stacktrace for this issue? You can see how I am creating tests for bugs here. https://github.com/managedfusion/fluentcassandra/blob/master/test/FluentCassandra.Tests/Bugs/Issue25JavaBigDecimalBinaryConversion.cs |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
Smoles
May 14, 2012
Here's the code that causes the issue:
_db.ExecuteNonQuery("CREATE TABLE OfferReservation (KEY int PRIMARY KEY) WITH comparator = text AND default_validation = float");
_db.ExecuteNonQuery("INSERT INTO OfferReservation (KEY, '25:100') VALUES (5, 0.25)");
_db.ExecuteNonQuery("INSERT INTO OfferReservation (KEY, '25:101') VALUES (5, 0.25)");
_db.ExecuteNonQuery("DELETE '25:100' FROM OfferReservation WHERE KEY = 5");
List<ICqlRow> rows = _db.ExecuteQuery("SELECT '25:100' FROM OfferReservation WHERE KEY = 5").ToList();
Here's the exception details:
System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=FluentCassandra
StackTrace:
at FluentCassandra.Types.CassandraObjectConverter1.ConvertEndian(Byte[] value) in C:\SourceCode\FluentCassandra\src\Types\CassandraObjectConverter.cs:line 64 at FluentCassandra.Types.CassandraObjectConverter
1.FromBigEndian(Byte[] value) in C:\SourceCode\FluentCassandra\src\Types\CassandraObjectConverter.cs:line 55
at FluentCassandra.Types.FloatType.SetValueFromBigEndian(Byte[] value) in C:\SourceCode\FluentCassandra\src\Types\FloatType.cs:line 28
at FluentCassandra.Types.CassandraObject.GetTypeFromDatabaseValue(Byte[] value, CassandraType cassandraType) in C:\SourceCode\FluentCassandra\src\Types\CassandraObject.cs:line 200
at FluentCassandra.Operations.Helper.ConvertColumnToFluentColumn(Column col, CassandraColumnFamilySchema schema) in C:\SourceCode\FluentCassandra\src\Operations\Helper.cs:line 231
at FluentCassandra.Operations.ExecuteCqlQuery.d__9.MoveNext() in C:\SourceCode\FluentCassandra\src\Operations\ExecuteCqlQuery.cs:line 104
at FluentCassandra.FluentColumnList1..ctor(FluentColumnParent parent, IEnumerable
1 columns) in C:\SourceCode\FluentCassandra\src\FluentColumnList1.cs:line 33 at FluentCassandra.FluentColumnFamily..ctor(CassandraObject key, String columnFamily, CassandraColumnFamilySchema schema, IEnumerable
1 columns) in C:\SourceCode\FluentCassandra\src\FluentColumnFamily.cs:line 55
at FluentCassandra.Operations.ExecuteCqlQuery.d__1.MoveNext() in C:\SourceCode\FluentCassandra\src\Operations\ExecuteCqlQuery.cs:line 89
at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at CassandraPrototype.CassandraRest.CreateOfferReservationCf() in C:\TeamProjects2010\Innovation\CassandraPrototype\CassandraPrototype\CassandraRest.svc.cs:line 169
at SyncInvokeCreateOfferReservationCf(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
InnerException:
Smoles
commented
May 14, 2012
Here's the code that causes the issue:
Here's the exception details: System.NullReferenceException was unhandled by user code |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
nberardi
May 14, 2012
Contributor
Can you create a test similar to how I did for the other issue, and send me a pull request for the code. If you create the test and get it to break, I can work on getting a fix for you.
Can you create a test similar to how I did for the other issue, and send me a pull request for the code. If you create the test and get it to break, I can work on getting a fix for you. |
Smoles commentedMay 10, 2012
So I deleted a column from a row and then attempted to do a select for that column on that row and FluentCassandra threw an exception. From my understanding, when a column is "deleted" in Cassandra it's actually marked as tombstoned and technically still exits until garbage collection hits. However, it's value is set to NULL. When you attempt to select that column Cassandra actually returns the column with a null value. FluentCassandra then attempts to convert that value to the appropriate datatype but blows up because the byte array is null.
I'm not sure what the best way to handle this is but I'm thinking that if the column is returned with a NULL value then FluentCassandra should treat it as if it doesn't exist and skip trying to add it to the columns collection for that row.
I was doing all of my commands using CQL. The data type for the column name was text and for the value it was float.