Hi,
I'm new to the list but not new to Cassandra. I'm writing an app on top of
C* and I have come across an issue (huge cell buffer size after applying a
mutation) that I haven't been able to resolve yet. I would appreciate any
suggestions/help to resolve this. Here are the details:
1. I have a column family defined as follows:
TableMetadata.Builder metadata =
TableMetadata
.builder(KEYSPACE1, CF_STANDARD1)
.addPartitionKeyColumn("key", Int32Type.instance)
.addRegularColumn(
"a",
MapType.getInstance(AsciiType.instance,
SetType.getInstance(UTF8Type.instance,false),false))
.addRegularColumn("b", UTF8Type.instance);
2. And here's a test that I wrote and works on cassandra-4.0 branch:
Row.Builder builder = BTreeRow.unsortedBuilder();
builder.newRow(Clustering.EMPTY);
ColumnMetadata def = metadata.getColumn(new ColumnIdentifier("b", true));
Cell<?> cell = BufferCell.live(def, System.currentTimeMillis(),
UTF8Type.instance.decompose("/b1"));
builder.addCell(cell);
PartitionUpdate update = PartitionUpdate.singleRowUpdate(metadata, dk,
builder.build());
new Mutation(update).apply();
Row row = Util.getOnlyRow(Util.cmd(cfs, dk).withLimit(1).build());
assertEquals(3, row.getCell(def).buffer().array().length);
3. However, in my app when I do the getOnlyRow after applying the mutation
the string value of b is 3 but the buffer().array().length is 1048576.
4. Restarting the app (which starts the cassandra daemon), fixes the issue
i.e. getOnlyRow returns the correct buffer size.
5. I'm importing cassandra-all 4.0.1 and the app uses jdk-11.
If you need further info, please do not hesitate to ask.
- Neophytos
PS. I'm experimenting with C* internals for the first time so it's very
likely I'm doing something wrong.