mirror of https://github.com/apache/cassandra
Validate empty cell names from counter updates
patch by Aleksey Yeschenko; reviewed by Jeremiah Jordan for CASSANDRA-7798
This commit is contained in:
parent
48d6950c18
commit
62642fa97e
|
|
@ -1,4 +1,5 @@
|
|||
1.2.19
|
||||
* Validate empty cell names from counter updates (CASSANDRA-7798)
|
||||
* Improve PasswordAuthenticator default super user setup (CASSANDRA-7788)
|
||||
* Remove duplicates from StorageService.getJoiningNodes (CASSANDRA-7478)
|
||||
* Clone token map outside of hot gossip loops (CASSANDRA-7758)
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ public abstract class Constants
|
|||
throw new InvalidRequestException("Invalid null value for counter increment");
|
||||
long increment = ByteBufferUtil.toLong(bytes);
|
||||
ByteBuffer cname = columnName == null ? prefix.build() : prefix.add(columnName.key).build();
|
||||
cf.addCounter(new QueryPath(cf.metadata().cfName, null, cname), increment);
|
||||
cf.addColumn(params.makeCounter(cname, increment));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ public abstract class Constants
|
|||
throw new InvalidRequestException("The negation of " + increment + " overflows supported counter precision (signed 8 bytes integer)");
|
||||
|
||||
ByteBuffer cname = columnName == null ? prefix.build() : prefix.add(columnName.key).build();
|
||||
cf.addCounter(new QueryPath(cf.metadata().cfName, null, cname), -increment);
|
||||
cf.addColumn(params.makeCounter(cname, -increment));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ public class UpdateParameters
|
|||
: new Column(name, value, timestamp);
|
||||
}
|
||||
|
||||
public Column makeCounter(ByteBuffer name, long delta) throws InvalidRequestException
|
||||
{
|
||||
QueryProcessor.validateColumnName(name);
|
||||
return new CounterUpdateColumn(name, delta, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public Column makeTombstone(ByteBuffer name) throws InvalidRequestException
|
||||
{
|
||||
QueryProcessor.validateColumnName(name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue