OrientDB returns 空顶点当 运行 多个实例

OrientDB returns empty vertices when running multiple instances

测试应该是不言自明的,但无论如何,我们一直在寻找这个奇怪的错误,并且在进行了无数次不同的测试之后,将问题归结为这个。

服务器必须处理来自不同领域(例如来自不同域)的数据,最好将它们存储在完全不同的数据库中。

由于某些原因,OrientDB returns 空顶点当另一个 OrientGraph 在其他位置较早打开时。

希望这对于 Whosebug 的算法来说是足够无意义的文本,这里是代码:

@Test
public void testLowLevelMultipleRealms() throws Exception {

    String location=("plocal:"+StorageHandler.getBase("test")+"db/orient/");
    String location2=("plocal:"+StorageHandler.getBase("local")+"db/orient/");

    boolean importantVariable=true;
    if(importantVariable){
        //fails
        OrientGraph graph =  new OrientGraphFactory(location).setupPool(1,10).getTx();
        graph.shutdown();

        //also fails
        //OrientGraph graph =  new OrientGraphFactory(location).setupPool(1,10).getTx();

        //also fails
        //new OrientGraphFactory(location).setupPool(1,10);

        //doesn't fail
        //new OrientGraphFactory(location);

        //doesn't fail
        //OrientGraph graph =  new OrientGraphFactory(location2).setupPool(1,10).getTx();


    }
    OrientGraph graph =  new OrientGraphFactory(location2).setupPool(1,10).getTx();

    Vertex v = graph.getVertex("#9:1");
    assertNotNull(v);//passes
    assertNotNull(v.getProperty("title"));//fails iff. importantVariable==true


}

原来OrientDB只检查路径的最后一个文件夹来检查db:s是否相同。由于两条路径都以 db/orient 结尾,所以它搞砸了。添加一个冗余但唯一的子文件夹就可以了。

您也可以使用 $ 代替 /,它会起作用。