提交 7ef92fc7 authored 作者: Thomas Mueller's avatar Thomas Mueller

Undo changes

上级 5a56777c
...@@ -209,13 +209,16 @@ public class DiskFile implements CacheWriter { ...@@ -209,13 +209,16 @@ public class DiskFile implements CacheWriter {
DataOutputStream out = new DataOutputStream(buff); DataOutputStream out = new DataOutputStream(buff);
int blocks = (int) ((file.length() - OFFSET) / BLOCK_SIZE); int blocks = (int) ((file.length() - OFFSET) / BLOCK_SIZE);
out.writeInt(blocks); out.writeInt(blocks);
final int end = blocks/8; for (int i = 0, x = 0; i < blocks / 8; i++) {
byte[] tempBuff = new byte[end]; int mask = 0;
for (int i = 0; i < end; i++) { for (int j = 0; j < 8; j++) {
tempBuff[i] = (byte) (used.getByte(i << 3) & 255); if (used.get(x)) {
mask |= 1 << j;
}
x++;
}
out.write(mask);
} }
out.write(tempBuff, 0, tempBuff.length);
tempBuff = null;
out.writeInt(pageOwners.size()); out.writeInt(pageOwners.size());
ObjectArray<Storage> storages = ObjectArray.newInstance(); ObjectArray<Storage> storages = ObjectArray.newInstance();
for (int i = 0; i < pageOwners.size(); i++) { for (int i = 0; i < pageOwners.size(); i++) {
...@@ -297,18 +300,16 @@ public class DiskFile implements CacheWriter { ...@@ -297,18 +300,16 @@ public class DiskFile implements CacheWriter {
return; return;
} }
stage++; stage++;
byte[] temp = new byte[b2];
in.readFully(temp);
if (init) { if (init) {
for (int x = 0; x < b2; x += 8) { for (int x = 0; x < b2; x += 8) {
int mask = temp[x]; int mask = in.read();
if (mask != used.getByte(x)) { if (mask != used.getByte(x)) {
Message.throwInternalError("Redo failure, block: " + x + " expected: " + used.getByte(x) + " got: " + mask); Message.throwInternalError("Redo failure, block: " + x + " expected: " + used.getByte(x) + " got: " + mask);
} }
} }
} else { } else {
for (int x = 0; x < b2; x += 8) { for (int x = 0; x < b2; x += 8) {
int mask = temp[x]; int mask = in.read();
used.setByte(x, mask); used.setByte(x, mask);
} }
} }
...@@ -706,6 +707,7 @@ public class DiskFile implements CacheWriter { ...@@ -706,6 +707,7 @@ public class DiskFile implements CacheWriter {
} }
} }
} }
/** /**
* Called after a session deleted a row. This sets the last uncommitted * Called after a session deleted a row. This sets the last uncommitted
* delete id in the session. This is used to make sure empty space is not * delete id in the session. This is used to make sure empty space is not
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论