maedhroz commented on code in PR #2460:
URL: https://github.com/apache/cassandra/pull/2460#discussion_r1253608008
##########
src/java/org/apache/cassandra/index/sai/disk/format/IndexDescriptor.java:
##########
@@ -327,28 +328,33 @@ public long sizeOnDiskOfPerIndexComponent(IndexComponent
indexComponent, IndexCo
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean validatePerIndexComponents(IndexContext indexContext)
+ public boolean validatePerIndexComponents(IndexContext indexContext,
IndexValidation validation)
{
- logger.info(indexContext.logMessage("Validating per-column index
components"));
- return version.onDiskFormat().validatePerColumnIndexComponents(this,
indexContext, false);
- }
-
- @VisibleForTesting
- public boolean validatePerIndexComponentsChecksum(IndexContext
indexContext)
- {
- return version.onDiskFormat().validatePerColumnIndexComponents(this,
indexContext, true);
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean validatePerSSTableComponents()
- {
- return version.onDiskFormat().validatePerSSTableIndexComponents(this,
false);
+ if (validation != IndexValidation.NONE)
+ {
+ logger.info(indexContext.logMessage("Validating per-column index
components using mode " + validation));
+ boolean checksum = validation == IndexValidation.CHECKSUM;
+ return
version.onDiskFormat().validatePerColumnIndexComponents(this, indexContext,
checksum);
+ }
+ else
+ {
+ return true;
+ }
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean validatePerSSTableComponentsChecksum()
+ public boolean validatePerSSTableComponents(IndexValidation validation)
{
- return version.onDiskFormat().validatePerSSTableIndexComponents(this,
true);
+ if (validation != IndexValidation.NONE)
+ {
+ logger.info(logMessage("Validating per-sstable index components
using mode " + validation));
+ boolean checksum = validation == IndexValidation.CHECKSUM;
+ return
version.onDiskFormat().validatePerSSTableIndexComponents(this, checksum);
+ }
+ else
+ {
+ return true;
+ }
Review Comment:
nit: It's more or less a matter of preference, but these methods might be
clearer w/ just a...
```
if (validation == IndexValidation.NONE)
return true;
```
...at the start and then the rest w/o a full `if/else`.
--
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]