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

New experimental feature SHUTDOWN DEFRAG.

上级 e9e0d9bc
...@@ -12,7 +12,6 @@ import java.util.ArrayList; ...@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Hashtable;
import java.util.zip.CRC32; import java.util.zip.CRC32;
import org.h2.command.ddl.CreateTableData; import org.h2.command.ddl.CreateTableData;
import org.h2.command.dml.TransactionCommand; import org.h2.command.dml.TransactionCommand;
...@@ -175,7 +174,7 @@ public class PageStore implements CacheWriter { ...@@ -175,7 +174,7 @@ public class PageStore implements CacheWriter {
private boolean recordPageReads; private boolean recordPageReads;
private ArrayList<Integer> recordedPagesList; private ArrayList<Integer> recordedPagesList;
private Hashtable<Integer, Integer> recordedPagesIndex; private IntIntHashMap recordedPagesIndex;
/** /**
* The change count is something like a "micro-transaction-id". * The change count is something like a "micro-transaction-id".
...@@ -506,7 +505,7 @@ public class PageStore implements CacheWriter { ...@@ -506,7 +505,7 @@ public class PageStore implements CacheWriter {
cache.clear(); cache.clear();
ArrayList<Table> tables = database.getAllTablesAndViews(false); ArrayList<Table> tables = database.getAllTablesAndViews(false);
recordedPagesList = New.arrayList(); recordedPagesList = New.arrayList();
recordedPagesIndex = new Hashtable<Integer, Integer>(); recordedPagesIndex = new IntIntHashMap();
recordPageReads = true; recordPageReads = true;
for (int i = 0; i < tables.size(); i++) { for (int i = 0; i < tables.size(); i++) {
Table table = tables.get(i); Table table = tables.get(i);
...@@ -544,8 +543,8 @@ public class PageStore implements CacheWriter { ...@@ -544,8 +543,8 @@ public class PageStore implements CacheWriter {
} }
cache.clear(); cache.clear();
swap(source, target, temp); swap(source, target, temp);
Integer index = recordedPagesIndex.get(target); int index = recordedPagesIndex.get(target);
if (index != null) { if (index != IntIntHashMap.NOT_FOUND) {
recordedPagesList.set(index, source); recordedPagesList.set(index, source);
recordedPagesIndex.put(source, index); recordedPagesIndex.put(source, index);
} }
...@@ -1230,7 +1229,7 @@ public class PageStore implements CacheWriter { ...@@ -1230,7 +1229,7 @@ public class PageStore implements CacheWriter {
*/ */
void readPage(int pos, Data page) { void readPage(int pos, Data page) {
if (recordPageReads) { if (recordPageReads) {
if (pos >= MIN_PAGE_COUNT && !recordedPagesIndex.containsKey(pos)) { if (pos >= MIN_PAGE_COUNT && recordedPagesIndex.get(pos) == IntIntHashMap.NOT_FOUND) {
recordedPagesIndex.put(pos, recordedPagesList.size()); recordedPagesIndex.put(pos, recordedPagesList.size());
recordedPagesList.add(pos); recordedPagesList.add(pos);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论