adelapena commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1108386283
##########
test/unit/org/apache/cassandra/db/NativeCellTest.java:
##########
@@ -125,7 +125,7 @@ private static Cell<?> rndcell(ColumnMetadata col)
{
long timestamp = rand.nextLong();
int ttl = rand.nextInt();
- int localDeletionTime = rand.nextInt();
+ long localDeletionTime = Math.abs(rand.nextInt());
Review Comment:
`Random.nextInt` can return `Integer.MIN_VALUE`, and `Math.abs` produces a
negative value for it due to the overflow. So it's unlikely but we might end up
with a negative value here.
Also, this is not exercising the full range of possible local deletion
times, which goes beyond `Integer.MAX_VALUE`. We could instead use:
```java
long localDeletionTime =
ThreadLocalRandom.current().nextLong(Cell.MAX_DELETION_TIME + 1);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]