redisgraph-go icon indicating copy to clipboard operation
redisgraph-go copied to clipboard

[Bug] QueryResult parsing fails on node labels retrieval on read only replicas

Open marcinc opened this issue 1 year ago • 0 comments

I noticed an issue with the QueryResult -> parseRecords logic when running a query against a redis read-only replica. Specific issue around Labels retrieval that it called internally when parsing a node: https://github.com/RedisGraph/redisgraph-go/blob/3b0ad0971fcab5b4f4b74d28974e774cf938e290/query_result.go#L143 https://github.com/RedisGraph/redisgraph-go/blob/3b0ad0971fcab5b4f4b74d28974e774cf938e290/query_result.go#L178

Turned out the Labels() calls procedure internally https://github.com/RedisGraph/redisgraph-go/blob/3b0ad0971fcab5b4f4b74d28974e774cf938e290/graph.go#L283-L284 which disregards the mode for that procedure and always attempts to run RW g.Query(q) which will obviously fail on read-only replicas.

https://github.com/RedisGraph/redisgraph-go/blob/3b0ad0971fcab5b4f4b74d28974e774cf938e290/graph.go#L279

I'm happy to submit a PR for this issue as I've already solved it in my current project.

marcinc avatar Oct 06 '22 17:10 marcinc