Skip to content
Snippets Groups Projects
  1. Nov 16, 2021
    • Vladislav Shpilevoy's avatar
      error: report ER_READONLY reason in message · 39a462e0
      Vladislav Shpilevoy authored
      A previous commit added reason details as error fields. But error
      objects are serialized as strings by default thus loosing all the
      details.
      
      This commit makes ER_READONLY message contain the reason why it
      happened in a human-readable form. That way it will be well
      visible in the logs at least.
      
      Follow-up #5568
      39a462e0
    • Vladislav Shpilevoy's avatar
      box: enrich ER_READONLY with new details · f57b3142
      Vladislav Shpilevoy authored
      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.
      
      Now from the error object can tell whether it was raised because
      of box.cfg.read_only = true, or the instance is an orphan, or it
      has election enabled but is not a leader, or the transaction limbo
      belongs to another instance.
      
      The alternative to ClientError alteration via error_payload was
      not to touch struct error and introduce a new error type
      specifically for ER_READONLY via a new C++ class like
      ReadOnlyError. But it had drawbacks:
      
      - There may be clients who expect ER_READONLY to have ClientError
        type. For instance, they check err.code == ER_READONLY only for
        err.type == 'ClientError';
      
      - Having to introduce a new C++ class each time when want to add a
        new field into an error has to end. Rather sooner than later.
      
      Closes #5568
      
      @TarantoolBot document
      Title: box.error.READONLY new attributes
      
      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.
      f57b3142
    • Vladislav Shpilevoy's avatar
      luatest: add new helpers for 'server' object · 327a2187
      Vladislav Shpilevoy authored
      -- Wait until the instance becomes an elected leader.
      server:wait_election_leader()
      
      -- Wait until an election leader is found.
      server:wait_election_leader_found()
      
      -- Get numeric ID of the instance like in box.info.id.
      server:instance_id()
      
      -- Get UUID of the instance like in box.info.uuid.
      server:instance_uuid()
      
      These are going to be used in a new test in a next commit.
      327a2187
    • Vladislav Shpilevoy's avatar
      luatest: copy config in cluster:build_server() · 33ea6824
      Vladislav Shpilevoy authored
      It takes box.cfg config as an argument. And changes the argument
      by adding a new key 'command'. If the caller wants to pass the
      same box.cfg or slightly modified to several build_server() calls,
      it won't work - all options will be the same on all instances.
      
      For example:
      
          local cfg = {...}
          cfg.replication = {url1}
          cluster:build_server(cfg)
          cfg.replication = {url2}
          cluster:build_server(cfg)
      
      It will not work. Both servers will get the same 'command' and the
      same 'replication'.
      33ea6824
    • Vladislav Shpilevoy's avatar
      error: use error_payload in Lua · 54be00b6
      Vladislav Shpilevoy authored
      In Lua struct error used RTTI to return members of the error
      depending on its type. If a field was added to error's payload, it
      wasn't visible. The patch makes Lua use error_payload instead of
      RTTI. Now if the payload gets a new field, it becomes
      automatically visible in Lua without need to introduce a new
      method for it.
      
      Part of #5568
      Part of #4610
      Part of #4907
      54be00b6
    • Vladislav Shpilevoy's avatar
      error: use error_payload in MessagePack codecs · 45ac12ae
      Vladislav Shpilevoy authored
      Before this patch mp_error API could only encode and decode
      hardcoded fields from the C++ classes inheriting struct error.
      
      The fields are gone from the classes in a previous patch - moved
      into error_payload. Now to be able to support arbitrary fields in
      the payload the MessagePack encoding/decoding must use its content
      instead of hardcoded fields depending on error type.
      
      Part of #5568
      Part of #4610
      Part of #4907
      45ac12ae
    • Vladislav Shpilevoy's avatar
      error: use error_payload to store optional members · 5c709076
      Vladislav Shpilevoy authored
      error_payload is a part of struct error now. All the fields stored
      in C++ classes on top of struct error are moved into the payload.
      
      Part of #5568
      Part of #4610
      Part of #4907
      5c709076
    • Vladislav Shpilevoy's avatar
      error: move code to struct error from ClientError · 0acc60e7
      Vladislav Shpilevoy authored
      All optional fields soon will be moved into error_payload. Code
      was optional too. But it is needed too often, the most used field.
      The patch moves it into struct error to make it more accessible.
      
      Also in future it should allow to drop the hack
      ClientError::get_errcode() which tries to return error code
      depending on error type. But could just store the code right away.
      
      As a consequence of the patch, errors which didn't have an error
      code at all before, such as LuajitError, now have it 0 in Lua.
      
      Part of #5568
      Part of #4610
      0acc60e7
    • Vladislav Shpilevoy's avatar
      error: introduce error_payload · 2a9f0ab0
      Vladislav Shpilevoy authored
      It is a dictionary-like struct which stores keys with binary data
      values. The values are supposed to be arbitrary MessagePack blobs:
      number, string, bool, UUID, array, map, anything.
      
      The payload is an array inside instead of a hash table because
      number of keys will be <= 3 in all cases. And even when it will be
      public, it is very unlikely it will be bigger.
      
      Object of error_payload in a future patch will be stored in struct
      error and will allow to extend it dynamically with more members.
      
      This in turn is needed to extend ER_READONLY error with more
      details about why it happened.
      
      Part of #5568
      Part of #4907
      2a9f0ab0
    • Vladislav Shpilevoy's avatar
      uuid: move into libcore · 1a812213
      Vladislav Shpilevoy authored
      libuuid used to be a separate library since
      de11d68a ("CMake: refactor
      dependencies of internal libraries").
      
      Unclear what was it done for. The commit says "fir unit tests".
      But they perfectly fine can depend on libcore like many of them
      do already.
      
      Because of libuuid being a separate library, libcore can't use
      tt_uuid, because that would be a cyclic dependency. And that won't
      allow to introduce tt_uuid-dependent API in a next patch.
      
      Hence libuuid is merged into libcore.
      
      Needed for #5568
      1a812213
    • Vladislav Shpilevoy's avatar
      diag: return created error from diag_set() · d77232d7
      Vladislav Shpilevoy authored
      And from diag_add(). This will be helpful not to bother with
      box_error_last() and diag_last_error(diag_get()) in the future
      patch. It will change some attributes of a just created
      ER_READONLY error to add more details.
      
      Part of #5568
      d77232d7
  2. Nov 15, 2021
    • Vladislav Shpilevoy's avatar
      test: fix watcher unit test duplicate symbol · 50d5807e
      Vladislav Shpilevoy authored
      Watcher unit test linked with libbox and included
      core_test_utils.c. Both contain cord_on_yield() symbol.
      
      It is defined as a stub in core_test_utils and checks being inside
      of GC in libbox.
      
      Somehow it managed to link all this time just fine. And moreover
      the linker selected the correct symbol - the one from
      core_test_utils.
      
      But while making another patch (not submitted yet), some other
      unit test was changed a bit and the watcher unit test link stage
      started failing with 'cord_on_yield()' duplicate symbol.
      
      The patch drops core_test_utils from the test and makes it work
      with libbox correctly. To support that the test now needs to
      initialize the global Lua state.
      50d5807e
    • Georgy Moiseev's avatar
      rpm: actualize changelog · 0e83f330
      Georgy Moiseev authored
      Actualize changelog based on GitHub release pages changelogs. Some
      entries were skipped since they are not relevant to modern packages.
      Versions 1.8.1 and 2.0.4 changelogs were merged to 2.1.1 changelog.
      
      Closes #6397
      0e83f330
    • Georgy Moiseev's avatar
      debian: actualize changelog · 069ff078
      Georgy Moiseev authored
      Actualize changelog based on GitHub release pages changelogs. Some
      entries were skipped since they are not relevant to modern packages.
      Versions 1.8.1 and 2.0.4 changelogs were merged to 2.1.1 changelog.
      
      Part of #6397
      069ff078
    • Yaroslav Lobankov's avatar
      ci: add integration check for expirationd module · 1ac382f2
      Yaroslav Lobankov authored
      This patch extends the 'integration.yml' workflow and adds a new
      workflow call for running tests to verify integration between tarantool
      and the expiration module.
      
      Part of #5265
      Part of #6056
      Closes #6528
      1ac382f2
  3. Nov 11, 2021
Loading