hrpc: guard against time range inputs > Long.MAX_VALUE#297
hrpc: guard against time range inputs > Long.MAX_VALUE#297ciacono wants to merge 1 commit intotsuna:masterfrom
Conversation
445809a to
41a51ba
Compare
HBase max timestamp is Long.MAX_VALUE. Sending timestamps greater than this returns an IllegalArgumentException from HBase. Instead, let's catch this earlier in the gohbase driver.
| if !ok { | ||
| return errors.New("'TimestampUint64' option can only be used with mutation queries") | ||
| } | ||
| if ts > MaxTimestamp { |
There was a problem hiding this comment.
(GitHub is not allowing me to comment on lines that are not part of the diff, so I'm posting it here.)
In Timestamp you should also check the time. It's possible that the user passes in a time.Time that is before the unix epoch, which will end up being negative / a value greater than MaxTimestamp when converted to uint64.
|
|
||
| func (m *Mutate) toProto(isCellblocks bool, cbs [][]byte) (*pb.MutateRequest, [][]byte, uint32) { | ||
| var ts *uint64 | ||
| if m.timestamp != MaxTimestamp { |
There was a problem hiding this comment.
I think this was intentional behavior, though it looks odd. m.timestamp is set to MaxTimestamp (MaxUint64) by default during instantiation, which is meant to be interpreted as unset. So, that's why this code is not setting the pb value.
I think we may need to re-name MaxTimestamp to UnsetTimestamp and leave that as math.MaxUint64 then make MaxTimestamp be MaxInt64.
No description provided.