Commit 44cba967 authored by Antti Villberg's avatar Antti Villberg Committed by Tuukka Lehtonen
Browse files

Restore queries crashes upon rollback

gitlab #726

(cherry picked from commit fd11b863)
parent 848430e1
......@@ -43,7 +43,6 @@ import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.Statement;
import org.simantics.db.VirtualGraph;
import org.simantics.db.common.ByteFileReader;
import org.simantics.db.common.procedure.adapter.AsyncMultiProcedureAdapter;
import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.DatabaseException;
......@@ -70,7 +69,6 @@ import org.simantics.db.request.AsyncMultiRead;
import org.simantics.db.request.ExternalRead;
import org.simantics.db.request.MultiRead;
import org.simantics.db.request.RequestFlags;
import org.simantics.db.service.Bytes;
import org.simantics.layer0.Layer0;
import org.simantics.utils.DataContainer;
import org.simantics.utils.Development;
......@@ -78,6 +76,7 @@ import org.simantics.utils.FileUtils;
import org.simantics.utils.datastructures.Pair;
import org.simantics.utils.datastructures.collections.CollectionUtils;
import org.simantics.utils.datastructures.disposable.AbstractDisposable;
import org.slf4j.LoggerFactory;
import gnu.trove.procedure.TIntProcedure;
import gnu.trove.procedure.TLongProcedure;
......@@ -88,6 +87,8 @@ import gnu.trove.set.hash.TIntHashSet;
@SuppressWarnings({"rawtypes", "unchecked"})
final public class QueryProcessor extends AbstractDisposable implements ReadGraphSupport {
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(QueryProcessor.class);
public static int indent = 0;
......@@ -1136,11 +1137,17 @@ final public class QueryProcessor extends AbstractDisposable implements ReadGrap
File dir = new File(workspace, "queryData");
dir.mkdir();
for(File f : FileUtils.listFilesByExtension(dir, "queryData")) {
byte[] bytes = FileUtils.readFile(f);
QueryDeserializer qd = new QueryDeserializer(this, bytes);
qd.readHeaders();
qd.readQueries();
try {
for(File f : FileUtils.listFilesByExtension(dir, "queryData")) {
byte[] bytes = FileUtils.readFile(f);
QueryDeserializer qd = new QueryDeserializer(this, bytes);
qd.readHeaders();
qd.readQueries();
}
} catch (Exception e) {
LOGGER.error("Unexpected exception while restoring queries", e);
}
long end = System.nanoTime();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment