提交 2f77a60e authored 作者: noelgrandin's avatar noelgrandin

rename PageStore#systemSession to PageStore#pageStoreSession, to distinguish it…

rename PageStore#systemSession to PageStore#pageStoreSession, to distinguish it from Database#systemSession
上级 45e2c008
...@@ -1194,7 +1194,7 @@ public class Database implements DataHandler { ...@@ -1194,7 +1194,7 @@ public class Database implements DataHandler {
try { try {
pageStore.checkpoint(); pageStore.checkpoint();
if (!readOnly) { if (!readOnly) {
lockMeta(pageStore.getSystemSession()); lockMeta(pageStore.getPageStoreSession());
pageStore.compact(compactMode); pageStore.compact(compactMode);
} }
} catch (DbException e) { } catch (DbException e) {
......
...@@ -174,7 +174,7 @@ public class PageStore implements CacheWriter { ...@@ -174,7 +174,7 @@ public class PageStore implements CacheWriter {
private HashMap<Integer, Integer> reservedPages; private HashMap<Integer, Integer> reservedPages;
private boolean isNew; private boolean isNew;
private long maxLogSize = Constants.DEFAULT_MAX_LOG_SIZE; private long maxLogSize = Constants.DEFAULT_MAX_LOG_SIZE;
private final Session systemSession; private final Session pageStoreSession;
/** /**
* Each free page is marked with a set bit. * Each free page is marked with a set bit.
...@@ -220,7 +220,7 @@ public class PageStore implements CacheWriter { ...@@ -220,7 +220,7 @@ public class PageStore implements CacheWriter {
// trace.setLevel(TraceSystem.DEBUG); // trace.setLevel(TraceSystem.DEBUG);
String cacheType = database.getCacheType(); String cacheType = database.getCacheType();
this.cache = CacheLRU.getCache(this, cacheType, cacheSizeDefault); this.cache = CacheLRU.getCache(this, cacheType, cacheSizeDefault);
systemSession = new Session(database, null, 0); pageStoreSession = new Session(database, null, 0);
} }
/** /**
...@@ -388,11 +388,11 @@ public class PageStore implements CacheWriter { ...@@ -388,11 +388,11 @@ public class PageStore implements CacheWriter {
metaObjects.putAll(tempObjects); metaObjects.putAll(tempObjects);
for (PageIndex index: tempObjects.values()) { for (PageIndex index: tempObjects.values()) {
if (index.getTable().isTemporary()) { if (index.getTable().isTemporary()) {
index.truncate(systemSession); index.truncate(pageStoreSession);
index.remove(systemSession); index.remove(pageStoreSession);
} }
} }
systemSession.commit(true); pageStoreSession.commit(true);
tempObjects = null; tempObjects = null;
} }
metaObjects.clear(); metaObjects.clear();
...@@ -606,7 +606,7 @@ public class PageStore implements CacheWriter { ...@@ -606,7 +606,7 @@ public class PageStore implements CacheWriter {
writeIndexRowCounts(); writeIndexRowCounts();
log.checkpoint(); log.checkpoint();
writeBack(); writeBack();
commit(systemSession); commit(pageStoreSession);
writeBack(); writeBack();
log.checkpoint(); log.checkpoint();
...@@ -667,7 +667,7 @@ public class PageStore implements CacheWriter { ...@@ -667,7 +667,7 @@ public class PageStore implements CacheWriter {
if (isUsed(a)) { if (isUsed(a)) {
pageA = getPage(a); pageA = getPage(a);
if (pageA != null) { if (pageA != null) {
pageA.moveTo(systemSession, free); pageA.moveTo(pageStoreSession, free);
} }
free(a); free(a);
} }
...@@ -675,14 +675,14 @@ public class PageStore implements CacheWriter { ...@@ -675,14 +675,14 @@ public class PageStore implements CacheWriter {
if (isUsed(b)) { if (isUsed(b)) {
Page pageB = getPage(b); Page pageB = getPage(b);
if (pageB != null) { if (pageB != null) {
pageB.moveTo(systemSession, a); pageB.moveTo(pageStoreSession, a);
} }
free(b); free(b);
} }
if (pageA != null) { if (pageA != null) {
f = getPage(free); f = getPage(free);
if (f != null) { if (f != null) {
f.moveTo(systemSession, b); f.moveTo(pageStoreSession, b);
} }
free(free); free(free);
} }
...@@ -711,7 +711,7 @@ public class PageStore implements CacheWriter { ...@@ -711,7 +711,7 @@ public class PageStore implements CacheWriter {
trace.debug("move " + p.getPos() + " to " + free); trace.debug("move " + p.getPos() + " to " + free);
} }
try { try {
p.moveTo(systemSession, free); p.moveTo(pageStoreSession, free);
} finally { } finally {
changeCount++; changeCount++;
} }
...@@ -1383,7 +1383,7 @@ public class PageStore implements CacheWriter { ...@@ -1383,7 +1383,7 @@ public class PageStore implements CacheWriter {
} }
tempObjects.put(index.getId(), index); tempObjects.put(index.getId(), index);
} else { } else {
index.close(systemSession); index.close(pageStoreSession);
} }
} }
...@@ -1515,7 +1515,7 @@ public class PageStore implements CacheWriter { ...@@ -1515,7 +1515,7 @@ public class PageStore implements CacheWriter {
void redo(int tableId, Row row, boolean add) { void redo(int tableId, Row row, boolean add) {
if (tableId == META_TABLE_ID) { if (tableId == META_TABLE_ID) {
if (add) { if (add) {
addMeta(row, systemSession, true); addMeta(row, pageStoreSession, true);
} else { } else {
removeMeta(row); removeMeta(row);
} }
...@@ -1526,9 +1526,9 @@ public class PageStore implements CacheWriter { ...@@ -1526,9 +1526,9 @@ public class PageStore implements CacheWriter {
} }
Table table = index.getTable(); Table table = index.getTable();
if (add) { if (add) {
table.addRow(systemSession, row); table.addRow(pageStoreSession, row);
} else { } else {
table.removeRow(systemSession, row); table.removeRow(pageStoreSession, row);
} }
} }
...@@ -1540,7 +1540,7 @@ public class PageStore implements CacheWriter { ...@@ -1540,7 +1540,7 @@ public class PageStore implements CacheWriter {
void redoTruncate(int tableId) { void redoTruncate(int tableId) {
Index index = metaObjects.get(tableId); Index index = metaObjects.get(tableId);
Table table = index.getTable(); Table table = index.getTable();
table.truncate(systemSession); table.truncate(pageStoreSession);
} }
private void openMetaIndex() { private void openMetaIndex() {
...@@ -1560,32 +1560,32 @@ public class PageStore implements CacheWriter { ...@@ -1560,32 +1560,32 @@ public class PageStore implements CacheWriter {
data.persistData = true; data.persistData = true;
data.persistIndexes = true; data.persistIndexes = true;
data.create = false; data.create = false;
data.session = systemSession; data.session = pageStoreSession;
metaTable = new RegularTable(data); metaTable = new RegularTable(data);
metaIndex = (PageDataIndex) metaTable.getScanIndex( metaIndex = (PageDataIndex) metaTable.getScanIndex(
systemSession); pageStoreSession);
metaObjects.clear(); metaObjects.clear();
metaObjects.put(-1, metaIndex); metaObjects.put(-1, metaIndex);
} }
private void readMetaData() { private void readMetaData() {
Cursor cursor = metaIndex.find(systemSession, null, null); Cursor cursor = metaIndex.find(pageStoreSession, null, null);
// first, create all tables // first, create all tables
while (cursor.next()) { while (cursor.next()) {
Row row = cursor.get(); Row row = cursor.get();
int type = row.getValue(1).getInt(); int type = row.getValue(1).getInt();
if (type == META_TYPE_DATA_INDEX) { if (type == META_TYPE_DATA_INDEX) {
addMeta(row, systemSession, false); addMeta(row, pageStoreSession, false);
} }
} }
// now create all secondary indexes // now create all secondary indexes
// otherwise the table might not be created yet // otherwise the table might not be created yet
cursor = metaIndex.find(systemSession, null, null); cursor = metaIndex.find(pageStoreSession, null, null);
while (cursor.next()) { while (cursor.next()) {
Row row = cursor.get(); Row row = cursor.get();
int type = row.getValue(1).getInt(); int type = row.getValue(1).getInt();
if (type != META_TYPE_DATA_INDEX) { if (type != META_TYPE_DATA_INDEX) {
addMeta(row, systemSession, false); addMeta(row, pageStoreSession, false);
} }
} }
} }
...@@ -1596,12 +1596,12 @@ public class PageStore implements CacheWriter { ...@@ -1596,12 +1596,12 @@ public class PageStore implements CacheWriter {
index.getTable().removeIndex(index); index.getTable().removeIndex(index);
if (index instanceof PageBtreeIndex || index instanceof PageDelegateIndex) { if (index instanceof PageBtreeIndex || index instanceof PageDelegateIndex) {
if (index.isTemporary()) { if (index.isTemporary()) {
systemSession.removeLocalTempTableIndex(index); pageStoreSession.removeLocalTempTableIndex(index);
} else { } else {
index.getSchema().remove(index); index.getSchema().remove(index);
} }
} }
index.remove(systemSession); index.remove(pageStoreSession);
metaObjects.remove(id); metaObjects.remove(id);
} }
...@@ -1969,7 +1969,7 @@ public class PageStore implements CacheWriter { ...@@ -1969,7 +1969,7 @@ public class PageStore implements CacheWriter {
public BitField getObjectIds() { public BitField getObjectIds() {
BitField f = new BitField(); BitField f = new BitField();
Cursor cursor = metaIndex.find(systemSession, null, null); Cursor cursor = metaIndex.find(pageStoreSession, null, null);
while (cursor.next()) { while (cursor.next()) {
Row row = cursor.get(); Row row = cursor.get();
int id = row.getValue(0).getInt(); int id = row.getValue(0).getInt();
...@@ -1980,8 +1980,8 @@ public class PageStore implements CacheWriter { ...@@ -1980,8 +1980,8 @@ public class PageStore implements CacheWriter {
return f; return f;
} }
public Session getSystemSession() { public Session getPageStoreSession() {
return systemSession; return pageStoreSession;
} }
public synchronized void setBackup(boolean start) { public synchronized void setBackup(boolean start) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论