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