adelapena commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1171493480
##########
src/java/org/apache/cassandra/io/sstable/format/big/BigFormat.java:
##########
@@ -411,7 +415,8 @@ static class BigVersion extends Version
hasCommitLogIntervals = version.compareTo("mc") >= 0;
hasAccurateMinMax = version.matches("(m[d-z])|(n[a-z])"); //
deprecated in 'nc' and to be removed in 'oa'
hasLegacyMinMax = version.matches("(m[a-z])|(n[a-z])"); //
deprecated in 'nc' and to be removed in 'oa'
- hasOriginatingHostId = version.matches("(m[e-z])") ||
version.compareTo("nb") >= 0;
+ // When adding a new version you might need to add it here
+ hasOriginatingHostId = version.matches("(m[e-z])|(o[a-z])") ||
version.compareTo("nb") >= 0;
Review Comment:
It seems that the `o[a-z]` part in `version.matches("(m[e-z])|(o[a-z])")` is
already covered by `version.compareTo("nb")`. So I think this can be simplified
to:
```suggestion
hasOriginatingHostId = version.matches("(m[e-z])") ||
version.compareTo("nb") >= 0;
```
We can also put the faster string comparison before the probably slower
pattern matching:
```suggestion
hasOriginatingHostId = version.compareTo("nb") >= 0 ||
version.matches("(m[e-z])");
```
--
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]