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

New experimental page store.

上级 aa3c5565
......@@ -18,7 +18,7 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>H2 Console: column of tables of non-default schemas are now also listed,
<ul><li>H2 Console: column of tables of non-default schemas are now also listed,
except for schemas starting with 'INFO'.
</li><li>ALTER TABLE: removing an auto-increment or identity column didn't remove the sequence.
</li><li>Creating indexes is now a bit faster.
......
......@@ -159,16 +159,16 @@ class PageDataLeaf extends PageData {
rows[0] = null;
do {
int type, size, next;
if (remaining <= pageSize - PageDataLeafOverflow.START_LAST) {
if (remaining <= pageSize - PageDataOverflow.START_LAST) {
type = Page.TYPE_DATA_OVERFLOW | Page.FLAG_LAST;
size = remaining;
next = 0;
} else {
type = Page.TYPE_DATA_OVERFLOW;
size = pageSize - PageDataLeafOverflow.START_MORE;
size = pageSize - PageDataOverflow.START_MORE;
next = index.getPageStore().allocatePage();
}
PageDataLeafOverflow overflow = new PageDataLeafOverflow(this, page, type, previous, next, data, dataOffset, size);
PageDataOverflow overflow = new PageDataOverflow(this, page, type, previous, next, data, dataOffset, size);
index.getPageStore().updateRecord(overflow, true, null);
dataOffset += size;
remaining -= size;
......@@ -232,7 +232,7 @@ class PageDataLeaf extends PageData {
int next = firstOverflowPageId;
int offset = pageSize;
do {
PageDataLeafOverflow page = index.getPageOverflow(next, this, offset);
PageDataOverflow page = index.getPageOverflow(next, this, offset);
next = page.readInto(data);
} while (next != 0);
overflowRowSize = data.length();
......@@ -287,7 +287,7 @@ class PageDataLeaf extends PageData {
if (firstOverflowPageId == 0) {
return;
}
PageDataLeafOverflow overflow = index.getPageOverflow(firstOverflowPageId, this, 0);
PageDataOverflow overflow = index.getPageOverflow(firstOverflowPageId, this, 0);
overflow.setParent(getPos());
index.getPageStore().updateRecord(overflow, true, null);
}
......@@ -310,7 +310,7 @@ class PageDataLeaf extends PageData {
PageStore store = index.getPageStore();
int next = firstOverflowPageId;
do {
PageDataLeafOverflow page = index.getPageOverflow(next, this, 0);
PageDataOverflow page = index.getPageOverflow(next, this, 0);
store.freePage(next, false, null);
next = page.getNextOverflow();
} while (next != 0);
......
......@@ -23,7 +23,7 @@ import org.h2.store.Record;
* </li><li>data
* </li></ul>
*/
public class PageDataLeafOverflow extends Record {
public class PageDataOverflow extends Record {
/**
* The start of the data in the last overflow page.
......@@ -62,7 +62,7 @@ public class PageDataLeafOverflow extends Record {
private Data data;
PageDataLeafOverflow(PageDataLeaf leaf, int pageId, int type, int previous, int next, Data allData, int offset, int size) {
PageDataOverflow(PageDataLeaf leaf, int pageId, int type, int previous, int next, Data allData, int offset, int size) {
this.index = leaf.index;
setPos(pageId);
this.type = type;
......@@ -85,10 +85,10 @@ public class PageDataLeafOverflow extends Record {
*
* @param leaf the leaf page
* @param pageId the page id
* @param dataAll the data page with the complete value
* @param data the data page
* @param offset the offset
*/
public PageDataLeafOverflow(PageDataLeaf leaf, int pageId, Data data, int offset) {
PageDataOverflow(PageDataLeaf leaf, int pageId, Data data, int offset) {
this.index = leaf.index;
setPos(pageId);
this.data = data;
......
......@@ -158,14 +158,14 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
* @param offset the offset in bytes
* @return the page
*/
PageDataLeafOverflow getPageOverflow(int id, PageDataLeaf leaf, int offset) throws SQLException {
PageDataOverflow getPageOverflow(int id, PageDataLeaf leaf, int offset) throws SQLException {
Record rec = store.getRecord(id);
if (rec != null) {
return (PageDataLeafOverflow) rec;
return (PageDataOverflow) rec;
}
Data data = store.readPage(id);
data.reset();
PageDataLeafOverflow result = new PageDataLeafOverflow(leaf, id, data, offset);
PageDataOverflow result = new PageDataOverflow(leaf, id, data, offset);
result.read();
return result;
}
......
......@@ -1439,7 +1439,7 @@ public class JdbcConnection extends TraceObject implements Connection {
int id = getNextId(TraceObject.CLOB);
debugCodeAssign("NClob", TraceObject.CLOB, id, "createNClob()");
checkClosedForWrite();
ValueLob v = ValueLob.createSmallLob(Value.CLOB, ByteUtils.EMPTY);
ValueLob v = ValueLob.createSmallLob(Value.CLOB, MemoryUtils.EMPTY_BYTES);
return new JdbcClob(this, v, id);
} catch (Exception e) {
throw logAndConvert(e);
......
......@@ -666,8 +666,8 @@ public class PageLog {
d.write(null);
}
/**
* Called after the recvovery has been completed.
/**
* Called after the recovery has been completed.
*/
void recoverEnd() {
sessionStates = New.hashMap();
......
......@@ -1019,7 +1019,7 @@ public class PageStore implements CacheWriter {
/**
* Create an array of SearchRow with the given size.
*
* @param len the number of bytes requested
* @param entryCount the number of elements
* @return the array
*/
public static SearchRow[] newSearchRows(int entryCount) {
......
......@@ -1071,7 +1071,11 @@ public abstract class TestBase {
return "-Dh2.pageStore=" + System.getProperty("h2.pageStore");
}
/**
* Use up almost all memory.
*
* @param remainingKB the number of kilobytes that are not referenced
*/
protected void eatMemory(int remainingKB) {
byte[] reserve = new byte[remainingKB * 1024];
int max = 128 * 1024 * 1024;
......@@ -1106,6 +1110,9 @@ public abstract class TestBase {
reserve = null;
}
/**
* Remove the hard reference to the memory.
*/
protected void freeMemory() {
memory.clear();
}
......
......@@ -103,6 +103,9 @@ public class TestMemoryUsage extends TestBase {
}
}
/**
* Eat memory so that all soft references are garbage collected.
*/
void freeSoftReferences() {
try {
eatMemory(1);
......
......@@ -594,4 +594,4 @@ ops jopr googlegroups fletcher prefer djava expires fffe polish articles
attachment transiently cleanup dbsnmp olapsys wmsys tsmsys outln ctxsys mddata
ordsys ordplugins mgmt dmsys exfsys mdsys sysman informtn textarray tmzone cdo
emf decompile streamed setmaxlengthinplacelob setcompresslob compressing
compressible subclass
\ No newline at end of file
compressible subclass ints seeks kilobytes
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论