lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.48k stars 520 forks source link

ValueLob len 的问题 #242

Closed cbqqkcel closed 1 month ago

cbqqkcel commented 1 month ago

https://github.com/lealone/Lealone/blob/20492a40688b0514f0b51579671c17cb160e1ca9/lealone-common/src/main/java/com/lealone/db/value/ValueLob.java#L101

int len = getBufferSize(handler, false, remaining); len = IOUtils.readFully(in, buff);

这里是不是应该这样,还是说getBufferSize(handler, false, remaining);没必要执行

getBufferSize(handler, false, remaining); len = IOUtils.readFully(in, buff);

140行也有同样的问题

codefollower commented 1 month ago

那个是 h2 数据库的遗留代码,确实没用到,它的新代码用了,从 readFully(InputStream in, byte[] buffer) 变成了 readFully(InputStream in, byte[] buffer, int max),底层都是调用 java.io.InputStream.read(byte[], int, int), max 这个参数并不一定是输入流的实际长度。