Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在neo4j索引中创建第128个节点后,无法访问更多节点_Java_Indexing_Nodes_Neo4j_Graph Databases - Fatal编程技术网

Java 在neo4j索引中创建第128个节点后,无法访问更多节点

Java 在neo4j索引中创建第128个节点后,无法访问更多节点,java,indexing,nodes,neo4j,graph-databases,Java,Indexing,Nodes,Neo4j,Graph Databases,这似乎是一个非常奇怪的问题。我正在对neo4j图形数据库进行压力测试,因此我的一个测试需要创建大量用户(在这个特定的测试中为1000)。因此,其代码如下所示 // Creates a n users and measures the time taken to add another n = 1000; tx = graphDb.beginTx(); try { for(int i = 0;

这似乎是一个非常奇怪的问题。我正在对neo4j图形数据库进行压力测试,因此我的一个测试需要创建大量用户(在这个特定的测试中为1000)。因此,其代码如下所示

// Creates a n users and measures the time taken to add another
            n = 1000;
            tx = graphDb.beginTx();
            try {
                for(int i = 0; i < n; i++){
                    dataService.createUser(BigInteger.valueOf(i));
                }

                start = System.nanoTime();
                dataService.createUser(BigInteger.valueOf(n));
                end = System.nanoTime();

                time = end - start;

                System.out.println("The time taken for createUser with " + n + " users is " + time +" nanoseconds.");

                tx.success();
            }
            finally
            {
                tx.finish();
            }
public User getUser(BigInteger identifier) throws DoesNotExistException {
        // Search for the user.
        Node userNode = this.nodeIndex.get(UserWrapper.KEY_IDENTIFIER,
                identifier).getSingle();
        // Return the wrapped user, if found.
        if (userNode != null) {
            return new UserWrapper(userNode);
        } else {
            throw new DoesNotExistException("User with identifier '"
                    + identifier.toString() + "' was not found.");
        }
    }
现在我需要在创建这些用户之后调用dataService.getUser()。getUser()的代码如下所示

// Creates a n users and measures the time taken to add another
            n = 1000;
            tx = graphDb.beginTx();
            try {
                for(int i = 0; i < n; i++){
                    dataService.createUser(BigInteger.valueOf(i));
                }

                start = System.nanoTime();
                dataService.createUser(BigInteger.valueOf(n));
                end = System.nanoTime();

                time = end - start;

                System.out.println("The time taken for createUser with " + n + " users is " + time +" nanoseconds.");

                tx.success();
            }
            finally
            {
                tx.finish();
            }
public User getUser(BigInteger identifier) throws DoesNotExistException {
        // Search for the user.
        Node userNode = this.nodeIndex.get(UserWrapper.KEY_IDENTIFIER,
                identifier).getSingle();
        // Return the wrapped user, if found.
        if (userNode != null) {
            return new UserWrapper(userNode);
        } else {
            throw new DoesNotExistException("User with identifier '"
                    + identifier.toString() + "' was not found.");
        }
    }
所以在我创建第129个用户之前,一切都很顺利。我在调试器中跟踪并观察dataService.getUser(biginger.valueOf(1))的值,它是第二个节点,dataService.getUser(biginger.valueOf(127))是第128个节点,dataService.getUser(biginger.valueOf(I-1))是最后创建的节点。调试器告诉我,在创建节点128之后,不会创建节点129和更高版本,因为getUser()会为这些节点抛出DoesNotExistException,但仍会为节点2和节点128提供值

我传递给createUser()的用户id是自动索引的


你知道为什么它没有生成更多的节点(或者没有索引这些节点)?

这听起来像是一个字节值转换,在128处翻转。你能确保你的代码中没有类似的东西吗?

很好,我应该意识到这一点。我的用户id存储为字节数组。我把它们换成了longs,一切正常。