-
Notifications
You must be signed in to change notification settings - Fork 33
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
Don't delete response collectors in a transaction #369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.6.1 | ||
2.6.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ private boolean fetchAndCheck() { | |
case STREAM_RES_PART: | ||
switch (resPart.getStreamResPart().getState()) { | ||
case DONE: | ||
stream.iteratorDone(requestID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still need the bidirectional stream in this class at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm!! |
||
state = State.DONE; | ||
return false; | ||
case CONTINUE: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ | |
import com.vaticle.typedb.client.api.TypeDBSession; | ||
import com.vaticle.typedb.client.api.TypeDBTransaction; | ||
import com.vaticle.typedb.client.api.answer.ConceptMap; | ||
import com.vaticle.typedb.client.api.concept.type.AttributeType; | ||
import com.vaticle.typedb.client.api.concept.type.EntityType; | ||
import com.vaticle.typedb.client.api.logic.Explanation; | ||
import com.vaticle.typedb.common.test.server.TypeDBCoreRunner; | ||
import com.vaticle.typeql.lang.TypeQL; | ||
|
@@ -42,6 +44,7 @@ | |
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.concurrent.TimeoutException; | ||
import java.util.function.Consumer; | ||
import java.util.stream.Collectors; | ||
|
@@ -518,6 +521,23 @@ public void testSimpleExplanation() { | |
}, READ, TypeDBOptions.core().infer(true).explain(true)); | ||
} | ||
|
||
@Test | ||
public void testStreaming() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With these options (the default in TypeDB at time of writing), the server may respond with: 50 answers -> CONTINUE -> 1 answer [compensating for latency] -> DONE. The client will respond to CONTINUE with STREAM to keep iterating, and the server responds to STREAM with a 2nd DONE message. This is expected and should be handled correctly (ie: ignored) by the client. |
||
localhostTypeDBTX(tx -> { | ||
for (int i = 0; i < 51; i++) { | ||
tx.query().define(String.format("define person sub entity, owns name%d; name%d sub attribute, value string;", i, i)); | ||
} | ||
tx.commit(); | ||
}, TypeDBSession.Type.SCHEMA); | ||
localhostTypeDBTX(tx -> { | ||
for (int i = 0; i < 50; i++) { | ||
EntityType.Remote concept = tx.concepts().getEntityType("person").asRemote(tx); | ||
List<? extends AttributeType> attributeTypes = concept.getOwns(false).collect(toList()); | ||
Optional<ConceptMap> conceptMap = tx.query().match("match $x sub thing; limit 1;").findFirst(); | ||
} | ||
}, READ, TypeDBOptions.core().prefetch(true).prefetchSize(50)); | ||
} | ||
|
||
private String[] lionNames() { | ||
return new String[]{"male-partner", "female-partner", "young-lion"}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments on https://github.com/vaticle/typedb-client-python/pull/250/files, which this PR is a copy of.