java client 重建索引提示SpaceNotFound

v2.5的环境

private static void createIndex(NebulaPool pool)
            throws IOErrorException, AuthFailedException, NotValidConnectionException {
        Session session = pool.getSession(USER, PASSWORD, false);
        String createIndex = "USE movie; "
               // + "CREATE TAG INDEX IF NOT EXISTS actor_index on actor();"
               // + "CREATE TAG INDEX IF NOT EXISTS drama_index on drama();"
                + "REBUILD TAG INDEX actor_index; "
                + "REBUILD TAG INDEX drama_index;";
        ResultSet resp = session.execute(createIndex);
        if (!resp.isSucceeded()) {
            log.error(String.format("Execute: `%s'\n failed: %s",
                    createIndex, resp.getErrorMessage()));
            System.exit(1);
        }

    }

报错提示space为空

ERROR [main] - Execute: `USE movie; REBUILD TAG INDEX drama_index;'
 failed: SemanticError: Get index failed in space `': SpaceNotFound: 

Process finished with exit code 1

确认index就在这个space里。用console重建索引就成功了。

这个提示语,是不是你的中英文输入法没切换,用了中文字符下的单引号,而不是 ’

对。。。error输出我中文输入法写错了 :joy: :sweat_smile:。。但这应该不影响吧,这个模板是在log.error里的~
我把use space单独作为一个session提交就没事了。感觉像个bug,use space和rebuild之间需要时间间隔

1 个赞

是个已知bug,https://github.com/vesoft-inc/nebula/issues/2806。 你单独先执行下use space,然后再执行后面的rebuild操作吧。

1 个赞