OrientDB 3.0.6是否引发异步事务错误?为什么?
我试图在OrientDB3.0.6中解析一个将CSV插入图形数据库的命令。 csv文件包含25000个具有某些属性的文档。 当我尝试运行解析器时,出现以下错误:OrientDB 3.0.6是否引发异步事务错误?为什么?,orientdb,Orientdb,我试图在OrientDB3.0.6中解析一个将CSV插入图形数据库的命令。 csv文件包含25000个具有某些属性的文档。 当我尝试运行解析器时,出现以下错误: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot execute the request because an asynchronous operation is in progress. Please use a different conne
com.orientechnologies.orient.core.exception.ODatabaseException: Cannot execute the request because an asynchronous operation is in progress. Please use a different connection
DB name="sadosky"
at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:249)
at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:214)
at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperation(OStorageRemote.java:243)
这是加载部分数据的脚本
private void parseEtiquetas() {
try {
ClassLoader classLoader = getClass().getClassLoader();
CSVReader reader = new CSVReader(new FileReader(classLoader.getResource("CETA/CETA_set_de_entrenamiento.csv").getFile()));
reader.skip(1);
String[] docLine;
int i = 0;
Transaction t = sm.getCurrentTransaction();
System.out.println("Leyendo los datos y calculando los TF...");
while ((docLine = reader.readNext()) != null) {
i++;
System.out.println(""+i+"-------------------------------------------------");
System.out.println(" Doc: "+docLine[ID_NORMA]);
// procesar el documento para todas las etiquetas
// System.out.println("" + docsSize + " " + nextLine[ID_NORMA] + " " + nextLine.length);
Documento doc = getDocumento(docLine[ID_NORMA], t);
if (doc != null) {
System.out.println("Etiquetas: " + docLine[ETIQUETAS]);
String[] etiquetas = docLine[ETIQUETAS].split(",");
for (String etiqueta : etiquetas) {
etiqueta = etiqueta.trim();
System.out.println("--->"+etiqueta+"<");
// verificar si existe en la base
Etiqueta e = getEtiqueta(etiqueta, t);
if (e == null) {
System.out.println("Etiqueta nueva: " + etiqueta);
Etiqueta et = new Etiqueta(etiqueta);
e = t.store(et);
} else {
System.out.println("etiqueta.size: "+(e.getDocs()!=null?e.getDocs().size():0));
}
e.addDoc(doc);
t.commit();
}
} else {
System.out.println("ERROR AL PROCESAR ID_NORMA: " + docLine[ID_NORMA]+". EL DOC NO EXISTE!!!");
}
System.out.println("cerrado trasacción...");
System.out.println("cerrada.");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
private Documento getDocumento(String docId, Transaction t) {
Documento ret = null;
List<Documento> ld = t.query(Documento.class, "select from Documento where id_doc = ?", new Object[]{docId});
if (ld.size() > 0) {
ret = ld.get(0);
}
return ret;
}
我找不到东方3有什么不对。在导入15条记录后,它会因该错误而失败。始终记录15次,但不能在同一点失败。有时如果提交失败,那么查询也会失败。不清楚,我找不到。
此代码与OrientDB 2.2.29配合使用效果良好。这似乎与OrientGraph事务有关 事务类处理与数据库的连接,并执行其他一些操作。这是相关部分:
OrientGraph orientdbTransact;
/**
* Devuelve una transacción ya inicializada contra la base de datos.
*
* @param sm
*/
Transaction(SessionManager sm) {
this.sm = sm;
orientdbTransact = this.sm.getFactory().getTx();
this.objectMapper = this.sm.getObjectMapper();
}
...
}
你好,Marcelo D.Ré,问题只出现在版本3.0中,您尝试过Orientdb 2.2.36吗?没有。我下载的版本2的最后一个版本是2.2.29。我们现在使用的是3.0.6,但由于错误不清楚,我决定用2.2.29测试它,它就可以工作了。我继续在2.x版本上处理文档,因为这不是一个核心问题,但我需要在3.x版本中修复它。我将下载2.2.36,看看会发生什么。
OrientGraph orientdbTransact;
/**
* Devuelve una transacción ya inicializada contra la base de datos.
*
* @param sm
*/
Transaction(SessionManager sm) {
this.sm = sm;
orientdbTransact = this.sm.getFactory().getTx();
this.objectMapper = this.sm.getObjectMapper();
}
...
}