Skip to content

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

Open
@marcinc

Description

@marcinc

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:

values[idx] = qr.parseNode(c)
labels[i] = qr.graph.getLabel(labelIds[i])

Turned out the Labels() calls procedure internally

redisgraph-go/graph.go

Lines 283 to 284 in 3b0ad09

func (g *Graph) Labels() []string {
qr, _ := g.CallProcedure("db.labels", nil)
which disregards the mode for that procedure and always attempts to run RW g.Query(q) which will obviously fail on read-only replicas.

return g.Query(q)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions