Skip to content

Commit

Permalink
tiny fixes, rename type -> batchType to not confuse it with type() an…
Browse files Browse the repository at this point in the history
…d fix Batch weight calculation
  • Loading branch information
krummas committed Aug 31, 2018
1 parent 8385b17 commit 7d5425e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/java/org/apache/cassandra/audit/FullQueryLogger.java
Expand Up @@ -112,11 +112,11 @@ void logQuery(String query, QueryOptions queryOptions, QueryState queryState, lo
static class Batch extends AbstractLogEntry
{
private final int weight;
private final BatchStatement.Type type;
private final BatchStatement.Type batchType;
private final List<String> queries;
private final List<List<ByteBuffer>> values;

public Batch(BatchStatement.Type type,
public Batch(BatchStatement.Type batchType,
List<String> queries,
List<List<ByteBuffer>> values,
QueryOptions queryOptions,
Expand All @@ -127,12 +127,13 @@ public Batch(BatchStatement.Type type,

this.queries = queries;
this.values = values;
this.type = type;
this.batchType = batchType;

int weight = super.weight();

// weight, queries, values, batch type
weight += 8 + 2 * EMPTY_LIST_SIZE + 8;
weight += 4 + // weight
2 * EMPTY_LIST_SIZE + // two lists, queries & values
8; // enum size (batch type)

for (String query : queries)
weight += ObjectSizes.sizeOf(query);
Expand All @@ -157,7 +158,7 @@ protected String type()
public void writeMarshallable(WireOut wire)
{
super.writeMarshallable(wire);
wire.write(BATCH_TYPE).text(type.name());
wire.write(BATCH_TYPE).text(batchType.name());
ValueOut valueOut = wire.write(QUERIES);
valueOut.int32(queries.size());
for (String query : queries)
Expand Down

0 comments on commit 7d5425e

Please sign in to comment.