提交 6fad76b1 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 bfe7a536
...@@ -75,8 +75,9 @@ public class ConstraintCheck extends Constraint { ...@@ -75,8 +75,9 @@ public class ConstraintCheck extends Constraint {
return getCreateSQLForCopy(table, getSQL()); return getCreateSQLForCopy(table, getSQL());
} }
public void removeChildrenAndResources(Session session) { public void removeChildrenAndResources(Session session) throws SQLException {
table.removeConstraint(this); table.removeConstraint(this);
database.removeMeta(session, getId());
filter = null; filter = null;
expr = null; expr = null;
table = null; table = null;
......
...@@ -207,6 +207,7 @@ public class ConstraintReferential extends Constraint { ...@@ -207,6 +207,7 @@ public class ConstraintReferential extends Constraint {
if (refIndexOwner) { if (refIndexOwner) {
refTable.removeIndexOrTransferOwnership(session, refIndex); refTable.removeIndexOrTransferOwnership(session, refIndex);
} }
database.removeMeta(session, getId());
refTable = null; refTable = null;
index = null; index = null;
refIndex = null; refIndex = null;
......
...@@ -116,6 +116,7 @@ public class ConstraintUnique extends Constraint { ...@@ -116,6 +116,7 @@ public class ConstraintUnique extends Constraint {
if (indexOwner) { if (indexOwner) {
table.removeIndexOrTransferOwnership(session, index); table.removeIndexOrTransferOwnership(session, index);
} }
database.removeMeta(session, getId());
index = null; index = null;
columns = null; columns = null;
table = null; table = null;
......
...@@ -84,6 +84,7 @@ public class Comment extends DbObjectBase { ...@@ -84,6 +84,7 @@ public class Comment extends DbObjectBase {
} }
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
} }
public void checkRename() throws SQLException { public void checkRename() throws SQLException {
......
...@@ -673,7 +673,7 @@ public class Database implements DataHandler { ...@@ -673,7 +673,7 @@ public class Database implements DataHandler {
} }
} }
private synchronized void removeMeta(Session session, int id) throws SQLException { public synchronized void removeMeta(Session session, int id) throws SQLException {
SearchRow r = meta.getTemplateSimpleRow(false); SearchRow r = meta.getTemplateSimpleRow(false);
r.setValue(0, ValueInt.get(id)); r.setValue(0, ValueInt.get(id));
Cursor cursor = metaIdIndex.find(session, r, r); Cursor cursor = metaIdIndex.find(session, r, r);
......
...@@ -138,6 +138,7 @@ public class FunctionAlias extends DbObjectBase { ...@@ -138,6 +138,7 @@ public class FunctionAlias extends DbObjectBase {
} }
public synchronized void removeChildrenAndResources(Session session) throws SQLException { public synchronized void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
className = methodName = null; className = methodName = null;
javaMethod = null; javaMethod = null;
invalidate(); invalidate();
......
...@@ -106,6 +106,7 @@ public class Right extends DbObjectBase { ...@@ -106,6 +106,7 @@ public class Right extends DbObjectBase {
} else { } else {
grantee.revokeRole(session, grantedRole); grantee.revokeRole(session, grantedRole);
} }
database.removeMeta(session, getId());
grantedRole = null; grantedRole = null;
grantedTable = null; grantedTable = null;
grantee = null; grantee = null;
......
...@@ -66,6 +66,7 @@ public class Role extends RightOwner { ...@@ -66,6 +66,7 @@ public class Role extends RightOwner {
database.removeDatabaseObject(session, right); database.removeDatabaseObject(session, right);
} }
} }
database.removeMeta(session, getId());
invalidate(); invalidate();
} }
......
...@@ -63,7 +63,8 @@ public class Setting extends DbObjectBase { ...@@ -63,7 +63,8 @@ public class Setting extends DbObjectBase {
return DbObject.SETTING; return DbObject.SETTING;
} }
public void removeChildrenAndResources(Session session) { public void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
invalidate(); invalidate();
} }
......
...@@ -172,6 +172,7 @@ public class User extends RightOwner { ...@@ -172,6 +172,7 @@ public class User extends RightOwner {
database.removeDatabaseObject(session, right); database.removeDatabaseObject(session, right);
} }
} }
database.removeMeta(session, getId());
salt = null; salt = null;
ByteUtils.clear(passwordHash); ByteUtils.clear(passwordHash);
passwordHash = null; passwordHash = null;
......
...@@ -64,6 +64,7 @@ public class UserAggregate extends DbObjectBase { ...@@ -64,6 +64,7 @@ public class UserAggregate extends DbObjectBase {
} }
public synchronized void removeChildrenAndResources(Session session) throws SQLException { public synchronized void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
className = null; className = null;
javaClass = null; javaClass = null;
invalidate(); invalidate();
......
...@@ -48,6 +48,7 @@ public class UserDataType extends DbObjectBase { ...@@ -48,6 +48,7 @@ public class UserDataType extends DbObjectBase {
} }
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
} }
public void checkRename() throws SQLException { public void checkRename() throws SQLException {
......
...@@ -151,6 +151,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -151,6 +151,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
table.removeIndex(this); table.removeIndex(this);
remove(session); remove(session);
database.removeMeta(session, getId());
} }
public boolean canFindNext() { public boolean canFindNext() {
......
...@@ -49,6 +49,7 @@ public class Constant extends SchemaObjectBase { ...@@ -49,6 +49,7 @@ public class Constant extends SchemaObjectBase {
} }
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
invalidate(); invalidate();
} }
......
...@@ -107,6 +107,7 @@ public class Schema extends DbObjectBase { ...@@ -107,6 +107,7 @@ public class Schema extends DbObjectBase {
Constant obj = (Constant) constants.values().toArray()[0]; Constant obj = (Constant) constants.values().toArray()[0];
database.removeSchemaObject(session, obj); database.removeSchemaObject(session, obj);
} }
database.removeMeta(session, getId());
owner = null; owner = null;
invalidate(); invalidate();
} }
......
...@@ -117,7 +117,8 @@ public class Sequence extends SchemaObjectBase { ...@@ -117,7 +117,8 @@ public class Sequence extends SchemaObjectBase {
return DbObject.SEQUENCE; return DbObject.SEQUENCE;
} }
public void removeChildrenAndResources(Session session) { public void removeChildrenAndResources(Session session) throws SQLException {
database.removeMeta(session, getId());
invalidate(); invalidate();
} }
......
...@@ -236,8 +236,9 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -236,8 +236,9 @@ public class TriggerObject extends SchemaObjectBase {
return DbObject.TRIGGER; return DbObject.TRIGGER;
} }
public void removeChildrenAndResources(Session session) { public void removeChildrenAndResources(Session session) throws SQLException {
table.removeTrigger(session, this); table.removeTrigger(session, this);
database.removeMeta(session, getId());
table = null; table = null;
triggerClassName = null; triggerClassName = null;
triggerCallback = null; triggerCallback = null;
......
...@@ -54,7 +54,7 @@ public class FileSystemDisk extends FileSystem { ...@@ -54,7 +54,7 @@ public class FileSystemDisk extends FileSystem {
public void rename(String oldName, String newName) throws SQLException { public void rename(String oldName, String newName) throws SQLException {
File oldFile = new File(oldName); File oldFile = new File(oldName);
File newFile = new File(newName); File newFile = new File(newName);
if (oldFile.getName().equals(newFile.getName())) { if (oldFile.getAbsolutePath().equals(newFile.getAbsolutePath())) {
throw Message.getInternalError("rename file old=new"); throw Message.getInternalError("rename file old=new");
} }
if (!oldFile.exists()) { if (!oldFile.exists()) {
......
...@@ -332,13 +332,6 @@ public abstract class Table extends SchemaObjectBase { ...@@ -332,13 +332,6 @@ public abstract class Table extends SchemaObjectBase {
constraints.remove(0); constraints.remove(0);
database.removeSchemaObject(session, constraint); database.removeSchemaObject(session, constraint);
} }
while (sequences != null && sequences.size() > 0) {
Sequence sequence = (Sequence) sequences.get(0);
sequences.remove(0);
if (!getTemporary()) {
database.removeSchemaObject(session, sequence);
}
}
ObjectArray rights = database.getAllRights(); ObjectArray rights = database.getAllRights();
for (int i = 0; i < rights.size(); i++) { for (int i = 0; i < rights.size(); i++) {
Right right = (Right) rights.get(i); Right right = (Right) rights.get(i);
...@@ -346,6 +339,15 @@ public abstract class Table extends SchemaObjectBase { ...@@ -346,6 +339,15 @@ public abstract class Table extends SchemaObjectBase {
database.removeDatabaseObject(session, right); database.removeDatabaseObject(session, right);
} }
} }
database.removeMeta(session, getId());
// must delete sequences later (in case there is a power failure before removing the table object)
while (sequences != null && sequences.size() > 0) {
Sequence sequence = (Sequence) sequences.get(0);
sequences.remove(0);
if (!getTemporary()) {
database.removeSchemaObject(session, sequence);
}
}
} }
public void checkColumnIsNotReferenced(Column col) throws SQLException { public void checkColumnIsNotReferenced(Column col) throws SQLException {
......
...@@ -115,7 +115,7 @@ public class TableData extends Table implements RecordReader { ...@@ -115,7 +115,7 @@ public class TableData extends Table implements RecordReader {
throw Message.convert(e); throw Message.convert(e);
} }
} }
private void checkRowCount(Session session, Index index, int offset) { private void checkRowCount(Session session, Index index, int offset) {
if (SysProperties.CHECK && !database.isMultiVersion()) { if (SysProperties.CHECK && !database.isMultiVersion()) {
long rc = index.getRowCount(session); long rc = index.getRowCount(session);
...@@ -498,6 +498,7 @@ public class TableData extends Table implements RecordReader { ...@@ -498,6 +498,7 @@ public class TableData extends Table implements RecordReader {
} }
} }
scanIndex.remove(session); scanIndex.remove(session);
database.removeMeta(session, getId());
scanIndex = null; scanIndex = null;
lockExclusive = null; lockExclusive = null;
lockShared = null; lockShared = null;
......
...@@ -326,6 +326,7 @@ public class TableLink extends Table { ...@@ -326,6 +326,7 @@ public class TableLink extends Table {
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
super.removeChildrenAndResources(session); super.removeChildrenAndResources(session);
close(session); close(session);
database.removeMeta(session, getId());
driver = null; driver = null;
url = user = password = originalTable = null; url = user = password = originalTable = null;
conn = null; conn = null;
......
...@@ -221,6 +221,7 @@ public class TableView extends Table { ...@@ -221,6 +221,7 @@ public class TableView extends Table {
public void removeChildrenAndResources(Session session) throws SQLException { public void removeChildrenAndResources(Session session) throws SQLException {
removeViewFromTables(); removeViewFromTables();
super.removeChildrenAndResources(session); super.removeChildrenAndResources(session);
database.removeMeta(session, getId());
querySQL = null; querySQL = null;
index = null; index = null;
invalidate(); invalidate();
......
...@@ -75,6 +75,7 @@ import org.h2.test.synth.TestHaltApp; ...@@ -75,6 +75,7 @@ import org.h2.test.synth.TestHaltApp;
import org.h2.test.synth.TestJoin; import org.h2.test.synth.TestJoin;
import org.h2.test.synth.TestKill; import org.h2.test.synth.TestKill;
import org.h2.test.synth.TestKillRestart; import org.h2.test.synth.TestKillRestart;
import org.h2.test.synth.TestKillRestartMulti;
import org.h2.test.synth.TestRandomSQL; import org.h2.test.synth.TestRandomSQL;
import org.h2.test.synth.TestTimer; import org.h2.test.synth.TestTimer;
import org.h2.test.synth.sql.TestSynth; import org.h2.test.synth.sql.TestSynth;
...@@ -174,7 +175,7 @@ Adjust cache memory usage ...@@ -174,7 +175,7 @@ Adjust cache memory usage
Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
History: History:
CSV tool now support lineSeparator
Roadmap: Roadmap:
...@@ -472,6 +473,7 @@ DROP TABLE MY_TEST; ...@@ -472,6 +473,7 @@ DROP TABLE MY_TEST;
new TestCrashAPI().runTest(this); new TestCrashAPI().runTest(this);
new TestRandomSQL().runTest(this); new TestRandomSQL().runTest(this);
new TestKillRestart().runTest(this); new TestKillRestart().runTest(this);
new TestKillRestartMulti().runTest(this);
// unit // unit
new TestBitField().runTest(this); new TestBitField().runTest(this);
...@@ -513,10 +515,10 @@ DROP TABLE MY_TEST; ...@@ -513,10 +515,10 @@ DROP TABLE MY_TEST;
test.runTest(this); test.runTest(this);
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
TestBase.logError("Class not found: " + className, null); TestBase.printlnWithTime(0, className + " class not found");
} catch (NoClassDefFoundError e) { } catch (NoClassDefFoundError e) {
// ignore // ignore
TestBase.logError("Class not found: " + className, null); TestBase.printlnWithTime(0, className + " class not found");
} }
} }
......
...@@ -247,7 +247,7 @@ public abstract class TestBase { ...@@ -247,7 +247,7 @@ public abstract class TestBase {
printlnWithTime(time, getClass().getName() + " " + s); printlnWithTime(time, getClass().getName() + " " + s);
} }
private static void printlnWithTime(long time, String s) { static void printlnWithTime(long time, String s) {
String t = "0000000000" + time; String t = "0000000000" + time;
t = t.substring(t.length() - 6); t = t.substring(t.length() - 6);
System.out.println(t + " " + s); System.out.println(t + " " + s);
......
...@@ -24,9 +24,9 @@ public class TestKillRestart extends TestBase { ...@@ -24,9 +24,9 @@ public class TestKillRestart extends TestBase {
if (config.networked) { if (config.networked) {
return; return;
} }
deleteDb("corrupt"); deleteDb("killRestart");
String url = getURL("corrupt", true); String url = getURL("killRestart", true);
// String url = getURL("corrupt;CACHE_SIZE=2048;WRITE_DELAY=0;STORAGE=TEXT", true); // String url = getURL("killRestart;CACHE_SIZE=2048;WRITE_DELAY=0;STORAGE=TEXT", true);
String user = getUser(), password = getPassword(); String user = getUser(), password = getPassword();
String[] procDef = new String[] { "java", "-cp", "bin", getClass().getName(), "-url", url, "-user", user, String[] procDef = new String[] { "java", "-cp", "bin", getClass().getName(), "-url", url, "-user", user,
...@@ -35,7 +35,6 @@ public class TestKillRestart extends TestBase { ...@@ -35,7 +35,6 @@ public class TestKillRestart extends TestBase {
int len = getSize(2, 15); int len = getSize(2, 15);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Process p = Runtime.getRuntime().exec(procDef); Process p = Runtime.getRuntime().exec(procDef);
// InputStream err = p.getErrorStream();
InputStream in = p.getInputStream(); InputStream in = p.getInputStream();
OutputCatcher catcher = new OutputCatcher(in); OutputCatcher catcher = new OutputCatcher(in);
catcher.start(); catcher.start();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论