Running a 7.1.0.1 local aero server, the following code in go works (v7 sdk)
cp := aero.NewClientPolicy()
cp.User = ""
cp.Password = ""
cp.Timeout = 1 * time.Second
ash := aero.NewHost("127.0.0.1", 3000)
client, err := aero.NewClientWithPolicyAndHost(cp, ash)
if err != nil { fmt.Printf("Err: %v\n", err)}
statement := aero.NewStatement("myns", "myset", "SessionID", "Time")
qp := aero.NewQueryPolicy()
qp.FilterExpression = aero.ExpEq(aero.ExpStringBin("SessionID"), aero.ExpStringVal("48e9bb5c-d2e1-4e1c-b6c2-9b9dfd271add"))
recordset, err := client.Query(qp, statement)
cnt := 0
for res := range recordset.Results() {
cnt++
if res.Err != nil {
fmt.Printf("%#v\n", res.Err)
} else {
fmt.Printf("%#v\n", *res.Record)
}
}
fmt.Println("count of rows:", cnt)
recordset.Close()
but the following code in java fails (java8, aerospike-client-jdk8-8.1.1.jar)
ClientPolicy cp = new ClientPolicy();
cp.setUser("");
cp.setPassword("");
cp.setTimeout(1);
Host h = new Host("127.0.0.1", 3000);
AerospikeClient client = new AerospikeClient(cp, h);
Statement stmt = new Statement();
stmt.setNamespace("myns");
stmt.setSetName("myset");
stmt.setBinNames("SessionID", "Time");
QueryPolicy qp = new QueryPolicy();
qp.filterExp = Exp.build(Exp.eq(Exp.stringBin("SessionID"), Exp.val("48e9bb5c-d2e1-4e1c-b6c2-9b9dfd271add")));
try {
RecordSet rs = client.query(qp, stmt);
while (rs.next()) {
Record record = rs.getRecord();
System.out.printf("rec=[%s]\n", record.bins);
}
} catch (Exception e) {
System.out.printf("err=[%s]\n", e);
e.printStackTrace();
}
The error is com.aerospike.client.AerospikeException$InvalidNamespace: Error 20,1: Partition map empty
at com.aerospike.client.query.PartitionTracker.assignPartitionsToNodes(PartitionTracker.java:233) | |
---|---|
at com.aerospike.client.query.QueryPartitionExecutor.execute(QueryPartitionExecutor.java:83) | |
at com.aerospike.client.query.QueryPartitionExecutor.run(QueryPartitionExecutor.java:72) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) | |
at java.lang.Thread.run(Thread.java:750) |
Code seems the same, it’s not a server issue because the go client works. Any idea what I’m missing? Thanks.