-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live select in v3 provides the wrong RID. #7828
Comments
hi @pvalsecc Which API are you using? Could you please post a code snippet to reproduce the problem? Thanks Luigi |
I'm developing an Erlang driver. But here is the java program I've used to reverse engineer the stuff that was lacking in the protocol documentation: package ch.thus.erlping;
import com.orientechnologies.common.exception.OException;
import com.orientechnologies.orient.client.remote.OServerAdmin;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.db.record.ORecordOperation;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OLiveQuery;
import com.orientechnologies.orient.core.sql.query.OLiveResultListener;
import java.io.IOException;
import java.util.List;
public class Live {
public static final String DB_URL = "remote:localhost/test";
public static void main(String[] args) throws IOException, InterruptedException {
OServerAdmin admin = new OServerAdmin(DB_URL)
.connect("root", "root")
.createDatabase("graph", "plocal");
try {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DB_URL).open("root", "root");
try {
System.out.println("Create DB");
db.command(new OCommandSQL("create class Test")).execute();
System.out.println("LIVE");
List<ODocument> result = db.query(new OLiveQuery<ODocument>("live select from Test", new OLiveResultListener() {
public void onLiveResult(int iLiveToken, ORecordOperation iOp) throws OException {
System.out.println("Got result " + iOp.toString());
}
public void onError(int iLiveToken) {
System.out.println("Got error");
}
public void onUnsubscribe(int iLiveToken) {
System.out.println("Got unsubscribe");
}
}));
Integer token = result.get(0).field("token");
System.out.println("Token: " + token);
System.out.println("insert");
db.command(new OCommandSQL("insert into test set name = 'foo', surname = 'bar'")).execute();
System.out.println("wait");
Thread.sleep(10000);
System.out.println("unsubscribe");
db.command(new OCommandSQL("live unsubscribe " + token)).execute();
System.out.println("wait2");
Thread.sleep(10000);
} finally {
db.close();
}
} finally {
admin.dropDatabase("test");
admin.close();
}
}
} The output is:
Please notice the |
Also, please, notice the WARNING about the invalid token. |
My erlang test uses two different connections for the insert and the live select. Same problem. |
Hi @pvalsecc There are a couple of points here:
Thanks Luigi |
Last time I've checked nothing like that was documented for the binary protocol v37. I've tested with the Java libs version 3.0.0m2 with the same code and it's worse, I don't even get the insert notification. |
OrientDB Version: ca8d27f
Java Version: 1.8.0_131
OS: Ubuntu 17.04
Expected behavior
I do on a freshly created DB:
I expect to receive notifications with the correct RIDs when stuff is added to the
Test
table withINSERT INTO Test (x) VALUES ('X')
.Actual behavior
The INSERT command returns a correct RID (#25:0), but the notification I get from my live subscription has RID=#25:-2. I guess you send the notification before assigning the cluster position.
Steps to reproduce
Described in the "Expected behavior" section.
The text was updated successfully, but these errors were encountered: