OrientDB'yi test ediyorum ve OrientDB-Graph API'sini bilmiyorum. Ve şimdi kodu net olarak kopyaladım, İstisna'yı yükseltir. Sonraki my kodudur:OrientDB : neden her zaman: Sınıf zaten mevcut veritabanında mevcut
import com.tinkerpop.blueprints.impls.orient.*;
import com.tinkerpop.blueprints.Element.*;
import java.util.*;
class OrientInsert {
public static void testInsertion(OrientGraphNoTx graph) {
System.out.println(new Date());
int count = 1000;
for (int i = 0; i < count; ++i) {
OrientVertex vertex1 = graph.addVertex("class:CLASS1", "prop1", Integer.toString(i), "prop2", "22", "prop3", "3333");
for (int j = 0; j < count; ++j) {
OrientVertex vertex2 = graph.addVertex("class:CLASS2", "prop1", Integer.toString(i + j/1000), "prop2", "22", "prop3", "3333");
graph.addEdge(null, vertex1, vertex2, "v1v2");
}
}
graph.commit();
System.out.println(new Date());
}
public static void main(String[] args) {
OrientGraphFactory factory = new OrientGraphFactory("remote:10.240.137.12/test", "admin", "admin");
OrientGraphNoTx graph = factory.getNoTx();
OrientInsert.testInsertion(graph);
}
} `
Ve çıktı şöyledir: Görünüşe
Mar 29, 2016 11:45:19 AM com.orientechnologies.common.log.OLogManager log
INFO: OrientDB auto-config DISKCACHE=3,725MB (heap=14,288MB os=64,292MB disk=7,451MB)
Tue Mar 29 11:45:19 CST 2016
Exception in thread "main" com.orientechnologies.orient.server.distributed.ODistributedException: Error on execution distributed COMMAND
at com.orientechnologies.orient.server.distributed.ODistributedStorage.command(ODistributedStorage.java:346)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:67)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1323)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:400)
at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
Caused by: com.orientechnologies.orient.core.exception.OSchemaException: Class CLASS1 already exists in current database
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.doCreateClass(OSchemaShared.java:983)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:415)
at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.createClass(OSchemaProxy.java:127)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLCreateClass.execute(OCommandExecutorSQLCreateClass.java:179)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
at com.orientechnologies.orient.server.distributed.task.OSQLCommandTask.execute(OSQLCommandTask.java:116)
at com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.executeOnLocalNode(OHazelcastPlugin.java:810)
at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.onMessage(ODistributedWorker.java:279)
at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.run(ODistributedWorker.java:103)
, ilk graphDatabase içine vertex1 ve vertex2 ekler ve sınıfı1 ve class2 yaratır. Ama ikinci ekleme söz konusu olduğunda, hala class1 ve class2 yaratmak istiyor. Niye ya? Sınıfın oluşturulmasını nasıl kontrol edebilirim. Ancak, birçok kullanıcı bu api'yi test etmek için kullanıyor.
Merhaba @Qinger ben kodunuzu çalıştı ve benim için doğru –
Teşekkür çalışır (i sınırı 100 E ile sadece 2 köşe seçildi) denemek için. Bağımsız bir sunucuda mı yoksa dağıtılmış bir sunucu kümesinde mi çalıştırıyorsunuz? Şimdi, üç sunucu örneğine sahip olan kümede çalıştırıyorum. – Qinger
Tek başına bir sunucuda çalıştırıyorum, şimdi dağıtılmış bir sunucuyla çalışıyorum, ASAP –