-
Notifications
You must be signed in to change notification settings - Fork 22
Multi exec #42
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
Multi exec #42
Conversation
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
+ Coverage 68.32% 68.35% +0.02%
==========================================
Files 16 20 +4
Lines 401 474 +73
Branches 68 72 +4
==========================================
+ Hits 274 324 +50
- Misses 102 123 +21
- Partials 25 27 +2
Continue to review full report at Codecov.
|
pom.xml
Outdated
| <repositories> | ||
| <repository> | ||
| <id>snapshots-repo</id> | ||
| <url>https://oss.sonatype.org/content/repositories/snapshots</url> |
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.
@DvirDukhan do you still need this?
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.
removed
| */ | ||
| public Response<ResultSet> graphQuery(String graphId, String query, Object ...args){ | ||
| String preparedQuery = Utils.prepareQuery(query, args); | ||
| graphCaches.putIfAbsent(graphId, new GraphCache(graphId, redisGraph)); |
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.
@DvirDukhan I think you should avoid creating GraphCache on each query
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.
fixed
| graphCaches.putIfAbsent(graphId, new GraphCache(graphId, redisGraph)); | ||
| client.sendCommand(Command.QUERY, graphId, preparedQuery, "--COMPACT"); | ||
| return getResponse(new Builder<ResultSet>() { | ||
| @Override |
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.
Do you really need to create a new builder on each call, or can you reuse a "shared" builder?
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.
yes
| * @return response with result set with the procedure data | ||
| */ | ||
| public Response<ResultSet> graphCallProcedure(String graphId, String procedure){ | ||
| return graphCallProcedure(graphId, procedure, new ArrayList<>(), new HashMap<>()); |
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.
I think you should set the ArrayList(0), HashMap(0)
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.
or can you reuse the same const DS?
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.
fixed
| * @return response with result set with the procedure data | ||
| */ | ||
| public Response<ResultSet> graphCallProcedure(String graphId, String procedure, List<String> args ){ | ||
| return graphCallProcedure(graphId, procedure, args, new HashMap<>()); |
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.
same here HashMap(0)?
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.
fixed
| * @return response with the deletion running time statistics | ||
| */ | ||
| public Response<String> graphDeleteGraph(String graphId){ | ||
| graphCaches.remove(graphId); |
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.
Shouldn't the remove be after the delete command return?
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.
fixed
| Assert.assertNotNull(api.query("social", "MATCH (n) where n.s1=%s and n.s2=%s RETURN n", "S\"\'", "S\\'\\\"")); | ||
| Assert.assertNotNull(api.query("social", "MATCH (n) where n.s1='S\"\\'' RETURN n")); | ||
| } | ||
|
|
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.
please add another test with two transactions and watch
|
fixes #34 |
pom.xml
Outdated
| <groupId>redis.clients</groupId> | ||
| <artifactId>jedis</artifactId> | ||
| <version>3.0.1</version> | ||
| <version>3.1.0-m4</version> |
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.
3.1.0-rc
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.
fixed
|
|
||
| protected int id; | ||
| protected final Map<String, Property> propertyMap = new HashMap<>(); | ||
| int id; |
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.
do you really need it as packaged?
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.
fixed
| class GraphCacheList { | ||
|
|
||
| private Object mutex = new Object(); | ||
| private final Object mutex = new Object(); |
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.
why do you need this mutex? can't you just synchronized on data?
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.
changed
| try { | ||
| api.close(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); |
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.
should fail test
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.
@After annotation
| */ | ||
| @Override | ||
| protected ResultSet sendQuery(String graphId, String preparedQuery) { | ||
| Jedis conn = getConnection(); |
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.
try resource block?
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.
just try, no need to close resource at the end of the scope
| */ | ||
| @Override | ||
| public String deleteGraph(String graphId) { | ||
| Object response = getConnection().sendCommand(RedisGraphCommand.DELETE, graphId); |
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.
try resource block?
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.
same as above
| @Override | ||
| protected ResultSet sendQuery(String graphId, String preparedQuery) { | ||
| Jedis conn = getConnection(); | ||
| List<Object> rawResponse = (List<Object>) conn.sendCommand(RedisGraphCommand.QUERY, graphId, preparedQuery, "--COMPACT"); |
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.
"--COMPACT" const?
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.
fixed
…in general queries
…into multi-exec # Conflicts: # src/main/java/com/redislabs/redisgraph/impl/api/RedisGraph.java # src/main/java/com/redislabs/redisgraph/impl/resultset/ResultSetImpl.java
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
- Coverage 68.32% 68.14% -0.19%
==========================================
Files 16 20 +4
Lines 401 474 +73
Branches 68 72 +4
==========================================
+ Hits 274 323 +49
- Misses 102 124 +22
- Partials 25 27 +2
Continue to review full report at Codecov.
|
…into multi-exec
| conn.close(); | ||
| throw e; | ||
| } | ||
| return new ResultSetImpl(rawResponse, this, graphId, caches.getGraphCache(graphId)); |
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.
move into the catch block
added multi-exec support