sanpwc commented on code in PR #6903:
URL: https://github.com/apache/ignite-3/pull/6903#discussion_r2494452873
##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/raft/MetaStorageWriteHandler.java:
##########
@@ -392,10 +407,17 @@ void onSnapshotLoad() {
CommandId commandId =
CommandId.fromString(commandIdString);
Serializable result;
- if (entry.value().length == 1) {
- result = byteToBoolean(entry.value()[0]);
+
+ byte[] entryValue = entry.value();
+
+ assert entryValue != null;
+
+ // Byte arrays of length 1 are not exclusively booleans,
+ // so this check prevents misinterpreting non-boolean
values as booleans.
+ if (entryValue.length == 1 && (entryValue[0] | 1) == 1) {
Review Comment:
It also worth mentioning that even `(entryValue[0] | 1) == 1)` t doesn't
mean that invoke() result is actually boolean. Within `handleWriteCommand` we
will proceed with result as boolean only in case of `InvokeCommand`, In case of
`MultiInvokeCommand` we will wrap boolean with `StatementResult` and thus
effectively convert it back to undefined (0 | 1). It's up to the
`StatementResult` interpreter to convert it either to boolean or int using
`StatementResult#getAsBoolean` or `StatementResult#getAsInt`
--
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]