Skip to content

Conversation

@DvirDukhan
Copy link
Contributor

added multi-exec support

@DvirDukhan DvirDukhan requested a review from gkorland July 4, 2019 13:36
@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

Merging #42 into master will increase coverage by 0.02%.
The diff coverage is 75.15%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
.../com/redislabs/redisgraph/graph_entities/Edge.java 32% <ø> (ø) ⬆️
...edislabs/redisgraph/impl/resultset/HeaderImpl.java 53.33% <ø> (ø)
.../com/redislabs/redisgraph/graph_entities/Node.java 40% <ø> (ø) ⬆️
...edislabs/redisgraph/impl/resultset/RecordImpl.java 45.45% <ø> (ø)
...labs/redisgraph/impl/resultset/StatisticsImpl.java 67.64% <0%> (ø)
...slabs/redisgraph/impl/resultset/ResultSetImpl.java 81.91% <100%> (ø)
...islabs/redisgraph/impl/graph_cache/GraphCache.java 100% <100%> (ø) ⬆️
...bs/redisgraph/impl/graph_cache/GraphCacheList.java 100% <100%> (ø) ⬆️
...dislabs/redisgraph/impl/api/RedisGraphCommand.java 100% <100%> (ø)
src/main/java/com/redislabs/redisgraph/Header.java 100% <100%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7ea858...79c5dc5. Read the comment docs.

pom.xml Outdated
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
Copy link
Contributor

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?

Copy link
Contributor Author

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));
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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<>());
Copy link
Contributor

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)

Copy link
Contributor

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?

Copy link
Contributor Author

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<>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here HashMap(0)?

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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"));
}

Copy link
Contributor

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

@K-Jo
Copy link

K-Jo commented Jul 18, 2019

fixes #34

pom.xml Outdated
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.0.1</version>
<version>3.1.0-m4</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.1.0-rc

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should fail test

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try resource block?

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try resource block?

Copy link
Contributor Author

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"--COMPACT" const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

DvirDukhan and others added 5 commits July 21, 2019 13:37
…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
Copy link

codecov bot commented Jul 22, 2019

Codecov Report

Merging #42 into master will decrease coverage by 0.18%.
The diff coverage is 75%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
.../com/redislabs/redisgraph/graph_entities/Edge.java 32% <ø> (ø) ⬆️
...edislabs/redisgraph/impl/resultset/HeaderImpl.java 53.33% <ø> (ø)
...edislabs/redisgraph/impl/resultset/RecordImpl.java 45.45% <ø> (ø)
...labs/redisgraph/impl/resultset/StatisticsImpl.java 67.64% <0%> (ø)
...islabs/redisgraph/impl/graph_cache/GraphCache.java 100% <100%> (ø) ⬆️
...bs/redisgraph/impl/graph_cache/GraphCacheList.java 100% <100%> (ø) ⬆️
...dislabs/redisgraph/impl/api/RedisGraphCommand.java 100% <100%> (ø)
.../com/redislabs/redisgraph/graph_entities/Node.java 40% <100%> (ø) ⬆️
src/main/java/com/redislabs/redisgraph/Header.java 100% <100%> (ø) ⬆️
.../main/java/com/redislabs/redisgraph/ResultSet.java 100% <100%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76a3f13...d8bc765. Read the comment docs.

conn.close();
throw e;
}
return new ResultSetImpl(rawResponse, this, graphId, caches.getGraphCache(graphId));
Copy link
Contributor

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

@DvirDukhan DvirDukhan merged commit a736bc3 into master Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants