Unverified 提交 199c7ec4 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Fix updateMeta()

上级 ab9408d9
......@@ -915,11 +915,6 @@ public class Database implements DataHandler {
verifyMetaLocked(session);
}
meta.addRow(session, r);
if (isMVStore()) {
// TODO this should work without MVCC, but avoid risks at the
// moment
session.log(meta, UndoLogRecord.INSERT, r);
}
}
}
......@@ -1021,11 +1016,6 @@ public class Database implements DataHandler {
}
Row found = cursor.get();
meta.removeRow(session, found);
if (isMVStore()) {
// TODO this should work without MVCC, but avoid risks at
// the moment
session.log(meta, UndoLogRecord.DELETE, found);
}
if (SysProperties.CHECK) {
checkMetaFree(session, id);
}
......@@ -1724,22 +1714,32 @@ public class Database implements DataHandler {
* @param obj the database object
*/
public void updateMeta(Session session, DbObject obj) {
lockMeta(session);
synchronized (this) {
int id = obj.getId();
if(id > 0) {
if(!starting && !obj.isTemporary()) {
Row newRow = meta.getTemplateRow();
MetaRecord.populateRowFromDBObject(obj, newRow);
Row oldRow = metaIdIndex.getRow(session, id);
if (oldRow != null) {
meta.updateRow(session, oldRow, newRow);
if (isMVStore()) {
synchronizes (this) {
int id = obj.getId();
if (id > 0) {
if (!starting && !obj.isTemporary()) {
Row newRow = meta.getTemplateRow();
MetaRecord.populateRowFromDBObject(obj, newRow);
Row oldRow = metaIdIndex.getRow(session, id);
if (oldRow != null) {
meta.updateRow(session, oldRow, newRow);
}
}
// removeMeta(session, id);
// addMeta(session, obj);
// for temporary objects
objectIds.set(id);
}
}
} else {
lockMeta(session);
synchronized (this) {
int id = obj.getId();
removeMeta(session, id);
addMeta(session, obj);
// for temporary objects
objectIds.set(id);
if(id > 0) {
objectIds.set(id);
}
}
}
}
......@@ -1796,9 +1796,6 @@ public class Database implements DataHandler {
}
}
obj.checkRename();
int id = obj.getId();
lockMeta(session);
removeMeta(session, id);
map.remove(obj.getName());
obj.rename(newName);
map.put(newName, obj);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论