Skip to content

box.error.READONLY new attributes #2444

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

Closed
Tracked by #2960
TarantoolBot opened this issue Nov 16, 2021 · 0 comments · Fixed by #3618
Closed
Tracked by #2960

box.error.READONLY new attributes #2444

TarantoolBot opened this issue Nov 16, 2021 · 0 comments · Fixed by #3618
Assignees
Labels
2.10 errors feature A new functionality reference [location] Tarantool manual, Reference part

Comments

@TarantoolBot
Copy link
Collaborator

TarantoolBot commented Nov 16, 2021

Product: Tarantool
Since: 2.10.0-beta2
Audience/target: Tarantool users
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/error_object/
SME: @ Gerold103

Related to: #2445

Details

[from the commit message]:
ER_READONLY used not to have any details about the exact reason
why the instance is read-only. The patch changes that by adding
new fields into the error which explain why the error happened and
even help to avoid it for next requests.

[input from the TarantoolBot]:
Users could see the error code as box.error.READONLY in .code
field of an error object. The error didn't have any other
attributes except common ones like 'type'.

Now from the box.error.READONLY error users can see why it
happened. The reasons can be the following:

  • The instance has box.cfg.read_only = true. Then the READONLY
    error has at least these fields:
tarantool> err:unpack()
---
- reason: config
  code: 7
  type: ClientError
...
  • The instance is an orphan. It enters that state if number of
    connected replicas is < box.cfg.replication_connect_quorum. Then
    READONLY error has at least these fields:
tarantool> err:unpack()
---
- reason: orphan
  code: 7
  type: ClientError
...
  • The synchro queue has an owner which is not the given instance.
    It usually happens if synchronous replication is used and there is
    another instance who called box.ctl.promote(). Then READONLY
    error has at least these fields:
tarantool> err:unpack()
---
- queue_owner_id: <box.info.id of the queue owner>
  queue_owner_uuid: <box.info.uuid of the queue owner>
  reason: synchro
  term: <last known box.info.election.term of the owner>
  code: 7
  type: ClientError
...

Note than queue_owner_uuid sometimes might be not present.

  • The instance has box.cfg.election_mode not off and it is not
    a leader. Then READONLY error has at least these fields:
tarantool> err:unpack()
---
- state: <box.info.election.state of this instance>
  leader_id: <box.info.id of the leader>
  leader_uuid: <box.info.uuid of the leader>
  reason: election
  term: <box.info.election.term of this instance>
  code: 7
  type: ClientError
...

leader_id and leader_uuid might be absent if the leader is not
known. For example, an election is still in progress. Note, than
leader_uuid sometimes might be not present even if leader_id
is.

If multiple reasons are true at the same time, then only one is
returned in the following order of preference: election, synchro,
config, orphan.
Requested by @Gerold103 in tarantool/tarantool@f57b314

ToDo

  • Describe the new field of the error object -- .reason -- that is for the ER_READONLY error only.
  • Make a link to the description of the box.info.ro_reason ([3pt] box.info.ro_reason #2445): error_object.reason is the same as the box.info.ro_reason at the moment of throwing the error.
@veod32 veod32 added this to the Estimate [@veod32] milestone Dec 29, 2021
@veod32 veod32 changed the title box.error.READONLY new attributes [3pt] box.error.READONLY new attributes Dec 29, 2021
@veod32 veod32 added server [area] Task relates to Tarantool's server (core) functionality reference [location] Tarantool manual, Reference part feature A new functionality labels Dec 29, 2021
@veod32 veod32 removed this from the Estimate [@veod32] milestone Dec 29, 2021
@veod32 veod32 mentioned this issue Dec 29, 2021
4 tasks
@veod32 veod32 added this to the error milestone Dec 29, 2021
@veod32 veod32 removed this from the error milestone Mar 6, 2023
@veod32 veod32 added errors 2.10 and removed server [area] Task relates to Tarantool's server (core) functionality labels Mar 6, 2023
@veod32 veod32 changed the title [3pt] box.error.READONLY new attributes box.error.READONLY new attributes Mar 6, 2023
@andreyaksenov andreyaksenov self-assigned this Aug 15, 2023
@andreyaksenov andreyaksenov linked a pull request Aug 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 errors feature A new functionality reference [location] Tarantool manual, Reference part
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants