提交 bc47507a authored 作者: Thomas Mueller's avatar Thomas Mueller

Page store: inserting very large rows failed with ArrayIndexOutOfBoundsException.

上级 d69f1d98
......@@ -67,15 +67,12 @@ public class PageOutputStream extends OutputStream {
int pageSize = store.getPageSize();
int capacityPerPage = PageStreamData.getCapacity(pageSize);
int pages = PageStreamTrunk.getPagesAddressed(pageSize);
// allocate x data pages
int pagesToAllocate = pages;
int totalCapacity = pages * capacityPerPage;
while (totalCapacity < minBuffer) {
pagesToAllocate += pagesToAllocate;
totalCapacity += totalCapacity;
}
// allocate the next trunk page as well
pagesToAllocate++;
int pagesToAllocate = 0, totalCapacity = 0;
do {
// allocate x data pages plus one trunk page
pagesToAllocate += pages + 1;
totalCapacity += pages * capacityPerPage;
} while (totalCapacity < minBuffer);
int firstPageToUse = atEnd ? trunkPageId : 0;
store.allocatePages(reservedPages, pagesToAllocate, exclude, firstPageToUse);
reserved += totalCapacity;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论