- nebula 版本:2.0.0
- Java client:2.0.0-rc1
- 部署方式(分布式 / 单机 / Docker / DBaaS):单机
- 硬件信息
- 磁盘( 必须为 SSD ,不支持 HDD)
- CPU、内存信息:
- 出问题的 Space 的创建方式
- 问题的具体描述:
当我使用下述方式创建SPACE时会返回错误码:E_EXECUTION_ERROR(-8) SpaceNotFound
...
session.execute("CREATE SPACE IF NOT EXISTS test_0;");
session.execute("USE test_0;");
...
但当我将两个statement合并执行后,返回结果正常
session.execute("CREATE SPACE IF NOT EXISTS test_0;USE test_0;");
另外当我合理控制两个execute之间的间隔,也可以获得预期的返回
session.execute("CREATE SPACE IF NOT EXISTS test_0;");
Thread.sleep(3000)
session.execute("USE test_0;");
同样的现象还会出现在CREATE TAG和 INSERT TAG之间
请问为什么会出现上述现象?
完整测试代码如下:
public static void main(String[] args) throws UnknownHostException, NotValidConnectionException, IOErrorException, AuthFailedException, UnsupportedEncodingException, InterruptedException {
NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(10);
List<HostAddress> addresses = Arrays.asList(new HostAddress("172.16.100.219", 9669));
NebulaPool pool = new NebulaPool();
pool.init(addresses, nebulaPoolConfig);
Session session = pool.getSession("root", "nebula", false);
// execute("CREATE SPACE IF NOT EXISTS test_0;USE test_0;", session);
execute("CREATE SPACE IF NOT EXISTS test_0;", session);
execute("USE test_0;", session);
session.release();
pool.close();
}
public static void execute(String statement, Session session) throws UnsupportedEncodingException, IOErrorException {
ResultSet resultSet = session.execute(statement);
if (!resultSet.isSucceeded()) {
throw new RuntimeException(String.format("Error: %s(%d) %s%n", ErrorCode.VALUES_TO_NAMES.get(resultSet.getErrorCode()), resultSet.getErrorCode(), resultSet.getErrorMessage()));
}
}