提交 8995ba97 authored 作者: noelgrandin's avatar noelgrandin

simplify code: getMaxLengthInplaceLob() returns int, not long

上级 e77f6224
...@@ -196,13 +196,10 @@ public class ValueLob extends Value { ...@@ -196,13 +196,10 @@ public class ValueLob extends Value {
if (remaining < 0 || remaining > Integer.MAX_VALUE) { if (remaining < 0 || remaining > Integer.MAX_VALUE) {
remaining = Integer.MAX_VALUE; remaining = Integer.MAX_VALUE;
} }
long inplace = handler.getMaxLengthInplaceLob(); int inplace = handler.getMaxLengthInplaceLob();
if (inplace >= Integer.MAX_VALUE) {
inplace = remaining;
}
long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE; long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE;
if (m < remaining && m <= inplace) { if (m < remaining && m <= inplace) {
m = Math.min(remaining, inplace + 1); m = Math.min(remaining, inplace + 1L); // using "1L" to force long arithmetic
// the buffer size must be bigger than the inplace lob, otherwise we can't // the buffer size must be bigger than the inplace lob, otherwise we can't
// know if it must be stored in-place or not // know if it must be stored in-place or not
m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE); m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE);
......
...@@ -553,13 +553,10 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -553,13 +553,10 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
if (remaining < 0 || remaining > Integer.MAX_VALUE) { if (remaining < 0 || remaining > Integer.MAX_VALUE) {
remaining = Integer.MAX_VALUE; remaining = Integer.MAX_VALUE;
} }
long inplace = handler.getMaxLengthInplaceLob(); int inplace = handler.getMaxLengthInplaceLob();
if (inplace >= Integer.MAX_VALUE) {
inplace = remaining;
}
long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE; long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE;
if (m < remaining && m <= inplace) { if (m < remaining && m <= inplace) {
m = Math.min(remaining, inplace + 1); m = Math.min(remaining, inplace + 1L); // using "1L" to force long arithmetic
// the buffer size must be bigger than the inplace lob, otherwise we can't // the buffer size must be bigger than the inplace lob, otherwise we can't
// know if it must be stored in-place or not // know if it must be stored in-place or not
m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE); m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论