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

SHUTDOWN DEFAG didn't defragment the database completely if there was a unique…

SHUTDOWN DEFAG didn't defragment the database completely if there was a unique hash index for a memory table.
上级 b68aa8d0
...@@ -328,4 +328,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -328,4 +328,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
return false; return false;
} }
public boolean canScan() {
return true;
}
} }
...@@ -94,4 +94,8 @@ public class FunctionIndex extends BaseIndex { ...@@ -94,4 +94,8 @@ public class FunctionIndex extends BaseIndex {
return "function"; return "function";
} }
public boolean canScan() {
return false;
}
} }
...@@ -116,4 +116,8 @@ public class HashIndex extends BaseIndex { ...@@ -116,4 +116,8 @@ public class HashIndex extends BaseIndex {
throw DbException.getUnsupportedException("HASH"); throw DbException.getUnsupportedException("HASH");
} }
public boolean canScan() {
return false;
}
} }
...@@ -226,4 +226,11 @@ public interface Index extends SchemaObject { ...@@ -226,4 +226,11 @@ public interface Index extends SchemaObject {
*/ */
boolean isRowIdIndex(); boolean isRowIdIndex();
/**
* Can this index iterate over all rows?
*
* @return true if it can
*/
boolean canScan();
} }
...@@ -318,4 +318,8 @@ public class MultiVersionIndex implements Index { ...@@ -318,4 +318,8 @@ public class MultiVersionIndex implements Index {
return base.isRowIdIndex() && delta.isRowIdIndex(); return base.isRowIdIndex() && delta.isRowIdIndex();
} }
public boolean canScan() {
return base.canScan();
}
} }
...@@ -529,7 +529,7 @@ public class PageStore implements CacheWriter { ...@@ -529,7 +529,7 @@ public class PageStore implements CacheWriter {
cursor.get(); cursor.get();
} }
for (Index index : table.getIndexes()) { for (Index index : table.getIndexes()) {
if (index != scanIndex) { if (index != scanIndex && index.canScan()) {
cursor = index.find(s, null, null); cursor = index.find(s, null, null);
while (cursor.next()) { while (cursor.next()) {
// the data is already read // the data is already read
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论