rpuch commented on code in PR #1405:
URL: https://github.com/apache/ignite-3/pull/1405#discussion_r1046793045


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/io/AbstractDataPageIo.java:
##########
@@ -1438,6 +1438,22 @@ protected abstract void writeRowData(
             boolean newRow
     ) throws IgniteInternalCheckedException;
 
+
+    /**
+     * Narrows an {@code int} down to {@code short} throwing an exception if 
the value cannot be exactly represented as a {@code short}.
+     *
+     * @param intValue Value to narrow down.
+     * @return Resulting short value.
+     * @throws IllegalArgumentException If the provided value does not fit the 
{@code short} range.
+     */
+    protected static short narrowIntToShort(int intValue) {

Review Comment:
   Can a user configure a really large page, like 1Mb? If yes, then free space 
in a page might be around 1Mb, which is way more than 64kb. If the user does 
not have `-ea` (because they do this in production), they will get strange 
behavior instead of a proper exception.
   
   Assertions should be used only for catching programmer errors (i.e. our 
errors). They should not be used to protect against a possible 
misconfiguration. Also, tests would not help in such scenario.



-- 
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]

Reply via email to