Skip to content

kv,sql: replica command errors bubble up as-is to SQL clients #49868

Open
@knz

Description

@knz

Found in #49513, a KV error went through all the layers and popped up in the client unadulterated:

pq: unable to select removal target from [(n1,s1):?]; current replicas [(n2,s2):1 (n7,s7):2 (n1,s1):3 (n8,s8):4]: could not select an appropriate replica to be removed

The present issue is not about investigating the cause of the error and instead focuses on the communication of this error throughout CockroachDB.

There are a couple of problems with this situation:

  • it does not carry a pg error code
  • it does not provide SQL-level context (which type of operation was being performed)
  • it does not suggest whether the operation is retryable
  • it probably is overly confusing - there's nothing about the replica details that's remotely useful to the user of a SQL client.

The way forward would be to address this in SQL by:

  • logging the details of the error via %+v in the log file
  • replacing the details by a SQL-level summary of the situation (via errors.Handled())

cc @andreimatei if you have suggestions as to how/where to do this? Perhaps the error could be summarized by txncoordsender before it comes into SQL?

cc @asubiotto @jordanlewis for triage.

Jira issue: CRDB-4177

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-error-handlingError messages, error propagations/annotationsA-kv-clientRelating to the KV client and the KV interface.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.T-kvKV TeamT-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions