Skip to content
Snippets Groups Projects
  1. Nov 02, 2022
    • Timur Safin's avatar
      debugger: provide access to box lua sources · f32808f9
      Timur Safin authored
      tarantool.debug.getsources() used to provide
      lua sources only for libserver lua modules,
      and was not providing sources for src/box/lua/*
      modules.
      
      Now this code works:
      ```lua
      local tnt = require 'tarantool'
      local code1 = tnt.debug.getsources('box/session')
      local code1 = tnt.debug.getsources('@builtin/box/session..lua')
      ```
      
      Closes #7839
      
      NO_DOC=bugfix
      NO_CHANGELOG=later
      f32808f9
  2. Oct 26, 2022
    • Vladimir Davydov's avatar
      msgpack: fix crash on decode of 0xc1 · ced405af
      Vladimir Davydov authored
      0xc1 isn't a valid MsgPack header, but it was allowed by mp_check.
      As a result, msgpack.decode crashed while trying to decode it.
      This commit updates the msgpuck library to fix this issue.
      
      Closes #7818
      
      NO_DOC=bug fix
      ced405af
  3. Oct 19, 2022
    • Timur Safin's avatar
      debugger: console debugger changelog and doc · a2ba5013
      Timur Safin authored
      NO_TEST=see it elsewhere
      
      Part of #7593
      
      @TarantoolBot document
      Title: Console debugger for Lua
      
      Console debugger luadebug.lua
      ==============================
      
      Module `luadebug.lua` is available as console debugger of Lua scripts.
      It's activated via:
      
      ```
      local debugger = require 'luadebug'
      debugger()
      ```
      
      Originally we have used 3rd-party code from slembcke/debugger.lua but
      significantly refactored since then.
      
      Currently available console shell commands are:
      ```
          c|cont|continue
          - continue execution
          d|down
          - move down the stack by one frame
          e|eval $expression
          - execute the statement
          f|finish|step_out
          - step forward until exiting the current function
          h|help|?
          - print this help message
          l|locals
          - print the function arguments, locals and upvalues
          n|next|step_over
          - step forward by one line (skipping over functions)
          p|print $expression
          - execute the expression and print the result
          q|quit
          - exit debugger
          s|st|step|step_into
          - step forward by one line (into functions)
          t|trace|bt
          - print the stack trace
          u|up
          - move up the stack by one frame
          w|where $linecount
          - print source code around the current line
      ```
      
      Console debugger `luadebug.lua` allows to see sources of builtin
      Tarantool module (e.g. `@builtin/datetime.lua`), and it uses new
      function introduced for that purpose `tarantool.debug.getsources()`,
      one could use this function in any external GUI debugger (i.e. vscode
      or JetBrains) if need to show sources of builtin modules while they
      have been debugged.
      
      > Please see third_party/lua/README-luadebug.md for a fuller description
      > of an original luadebug.lua implementation.
      a2ba5013
    • Timur Safin's avatar
      debugger: luatest for console debugger · 0a5fb86d
      Timur Safin authored
      Created luatest test for interactive debugger luadebug.lua.
      We use separate debug-target.lua for execution under
      control of debugger session.
      
      NO_DOC=test
      NO_CHANGELOG=test
      0a5fb86d
    • Timur Safin's avatar
      debugger: retrieve @builtin/%s.lua sources · e608a737
      Timur Safin authored
      Extend Tarantool kernel internal API with the call
      `tarantool.debug.getsources()` to allow to retrieve sources
      of a Tarantool `builtin/*` modules to show them in the
      debugger shell.
      
      Created simple luatest script for checking consistency
      of a values returned from `require 'tarantool'.debug.getsources()`
      and an ctual script file content we expected to receive.
      
      NO_DOC=see future commit
      NO_CHANGELOG=see future commit
      e608a737
  4. Oct 05, 2022
  5. Sep 30, 2022
  6. Sep 26, 2022
    • Georgiy Lebedev's avatar
      test: replace Lua `assert`s with luatest `assert`s in luatest tests · 1d9645f7
      Georgiy Lebedev authored
      Some luatest framework tests use Lua `assert`s, which are incomprehensible
      when failed (the only information provided is 'assertion failed!'),
      making debugging difficult: replace them with luatest `assert`s and their
      context-specific varieties.
      
      NO_CHANGELOG=<code health>
      NO_DOC=<code health>
      1d9645f7
  7. Sep 16, 2022
    • Sergey Bronnikov's avatar
      httpc: implement encoding params · dc147ec9
      Sergey Bronnikov authored
      @TarantoolBot document
      Title: Document encoding parameters in http client
      
      New option "params" passed to HTTP request allows a user to add query
      parameters into URI. When option "params" contains a Lua table with
      key-value pairs these parameters encoded to a string and passed as an
      URL path in GET/HEAD/DELETE methods and as a HTTP body with POST method.
      In a latter case error will be raised when body is not empty.
      
      ```
      > uri = require("uri")
      > httpc = require("httpc")
      > params = { key1 = 'value1', key2 = uri.values('value1', 'value2') }
      > r = http.client.get("http://httpbin.org/get", { params = params })
      > r.url
      ---
      - http://httpbin.org/get?key1=value1&key2=value1&key2=value2
      ...
      
      ```
      
      Key and values could be a Lua number, string, boolean, anything that has
      a `__serialize` or `__tostring` metamethod. It is possible to pass
      datetime, decimal and number64 values.
      
      Limitations:
      
      - order of keys with values in a result string is not deterministic
      - percent encoding is not supported at the moment
      
      Closes #6832
      dc147ec9
    • Sergey Bronnikov's avatar
      uri: add function uri.values() · ffe7408c
      Sergey Bronnikov authored
      @TarantoolBot document
      Title: Document encoding HTTP parameters to a query string
      
      New method uri.values() allows a user to represent multivalue
      parameter's.
      
      Setting multivalue parameter with `uri.parse()` and `uri.format()`:
      
      ```
      > params = {q1 = uri.values("v1", "v2")}}
      > uri.format({host = 'brnkv.ru', params = params})
      ---
      - http://x.html?q1=v1&q1=v2
      ...
      
      > uri.parse({"/tmp/unix.sock", params = params)
      ---
      - host: unix/
        service: /tmp/unix.sock
        unix: /tmp/unix.sock
        params:
          q1:
          - v1
          - v2
      ...
      
      ```
      
      Key and values could be a Lua number, string, boolean, anything that has
      a `__serialize` or `__tostring` metamethod. It is possible to pass
      `datetime`, `decimal` and `number64` values too.
      
      NOTE: Order of keys with values in a result string is not deterministic.
      
      Needed for #6832
      ffe7408c
    • Sergey Bronnikov's avatar
      uri: encode table with http params to a string · b31aec89
      Sergey Bronnikov authored
      Patch introduces two internal functions: `uri.params()` and
      `uri.encode_kv()`.
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      
      Needed for #6832
      b31aec89
  8. Sep 12, 2022
    • Sergey Bronnikov's avatar
      httpc: decode body in http response · 6a364cbc
      Sergey Bronnikov authored
      @TarantoolBot document
      Title: Document a body decoding in http response
      
      New method "response:decode()" has been introduced for a HTTP response.
      It allows to decode body to a Lua object. Decoding depends on content
      type passed in HTTP header and decoding function for it defined in table
      `http.decoders` or `http.new().decoders`. Function `response:decode()`
      will raise an error when content type is present in the response, but
      there is no appropriate decoder.
      
      By default decoders for the following content types are defined:
      
      - to JSON with content-type "application/json"
      - to MsgPack with content-type "application/msgpack"
      - to YAML with content-type "application/yaml"
      
      If a content type is not present in the response, :decode() assumes
      "application/json".
      
      ```
      tarantool> resp = require('http.client').put(
          'http://127.0.0.1:8080', '{"productId": 123456, "quantity": 100}')
      ---
      ...
      
      tarantool> resp.body
      ---
      - '{"productId": 123456, "quantity": 100}'
      ...
      
      tarantool>
      tarantool> resp:decode()
      ---
      - productId: 123456
      - quantity: 100
      ...
      
      tarantool>
      ```
      
      For content types missed in `http.decoders` user could define it's own
      by defining a new record with a key equal to desired MIME type in
      lowercase and it's decoding function that must accept HTTP body, content
      type and must return a decoded value:
      
      ```
      local http = require("http")
      local xml = require("luarapidxml")
      
      http.decoders = {
          ['application/xml'] = function(body, _content_type)
              return xml.decode(body)
          end,
      }
      ```
      
      Closes #6833
      6a364cbc
    • Sergey Bronnikov's avatar
      httpc: encode body in http request · 4818e988
      Sergey Bronnikov authored
      client_object:request() could pass a body as a string value to HTTP
      request when body is used. User must encode body to a string value as a
      preparation step. However, we can do encoding for user
      automatically when it possible.
      
      @TarantoolBot document
      Title: Document body encoding in http request
      
      Now user could pass a "body" option as a value with standard Lua types
      (table, nil, string, userdata, cdata, boolean or number) as well as
      Tarantool's own data types like decimal, uuid, datetime. In such case
      that value will be encoded to a string automatically where it possible.
      
      Encoding depends on body's data type: `nil` converted to an empty
      string, types (`string`, `number`, `boolean` and `nil`) will be
      converted to a string using standard Lua function `tostring()`, types
      cdata, userdata and tables will be encoded by functions defined in
      `http.encoders` or `http.new().encoders` table. In latter case encoding
      function depends on a content type passed to HTTP request using HTTP
      header. Default content type "application/json" and appropriate encoder
      are used when content type is missed in HTTP request.
      
      By default encoders for the following content types are defined:
      
      - "application/json"
      - "application/msgpack"
      - "application/yaml"
      
      For content types missed in `http.encoders` user could define it's own
      encoder by defining a new record with a key equal to desired MIME type
      in lowercase and it's encoding function that must accept HTTP body and
      content type and must return a string with serialized data:
      
      ```
      local http = require("http")
      local xml = require("luarapidxml")
      
      http.encoders = {
          ['application/xml'] = function(body, _content_type)
              return xml.encode(body)
          end,
      }
      ```
      
      Be careful with defining your own encoding function - header with content
      type could contain content type like "text/html" as well as a header
      options [1], like "text/html; charset=UTF-8". Content type is passed to
      encoder function *with* options.
      
      JSON encoder will use default configuration settings defined in JSON
      module (see `json.cfg()`). Header with content type will be set to
      "application/json" if it was not defined by user in request's options.
      
      ```
      local http = require("http")
      local client = http.new()
      
      local body = {
          a = 1,
          b = 2,
          c = 3,
      }
      client:request("POST", uri, body)
      client:post(uri, body)
      ```
      
      1. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
      
      Part of #6833
      4818e988
  9. Sep 07, 2022
    • Ilya Verbin's avatar
      main: allow spurious wakeups in on_shutdown_f · dd65d5c6
      Ilya Verbin authored
      It will yield until the is_shutting_down flag is set by tarantool_exit().
      This allows to get rid of the FIBER_IS_CANCELLABLE flag, which is no
      longer used anywhere in Tarantool.
      
      Part of #7166
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      dd65d5c6
  10. Sep 05, 2022
    • Nikolay Shirokovskiy's avatar
      test: fix readline dependent tests · 55bab98c
      Nikolay Shirokovskiy authored
      The tests fail on dev installation if it's readline configuration
      (.inputrc) changes prompt. Use default readline configuration for
      the tests.
      
      Closes #7620
      
      NO_DOC=test changes
      NO_TEST=test changes
      NO_CHANGELOG=test changes
      55bab98c
    • Ilya Grishnov's avatar
      uri: fix resolve with only port specification · 96d8dcec
      Ilya Grishnov authored
      Supplemented the implementation of the `src/lib/uri` parser.
      Before this fix a call `uri.parse(uri.format(uri.parse(3301)))`
      returned an error of 'Incorrect URI'.
      Now this call return correct `service: '3301'`.
      As a result, the possibility of using host=localhost by default
      for `tarantoolctl connect` has been restored now.
      As well as for `console.connect`.
      
      Fixes #7479
      
      NO_DOC=bugfix
      96d8dcec
  11. Aug 30, 2022
    • Nikita Zheleztsov's avatar
      core: mark some internal fibers as system ones · 3733ff25
      Nikita Zheleztsov authored
      Currently internal tarantool fibers can be cancelled from the user's app,
      which can lead to critical errors.
      
      Let's mark these fibers as a system ones in order to be sure that they
      won't be cancelled from the Lua world.
      
      Closes #7448
      Closes #7473
      
      NO_DOC=minor change
      3733ff25
  12. Aug 19, 2022
    • Sergey Bronnikov's avatar
      test: fix flakiness in app-luatest/http_client_test.lua · 02fae15a
      Sergey Bronnikov authored
      The problem could be easily reproduced with following command line:
      ./test/test-run.py
      	$(yes app-luatest/http_client_test.lua | head -n 1000).
      
      Before this commit we did a socket binding to know a free network port,
      then close a socket and started httpd.py on that network port. However
      it was not reliable and even with socket options SO_REUSE_PORT start of
      httpd.py has failed. With proposed patch schema is changed: we start
      httpd.py and pass only a socket family (AF_INET for TCP connection and
      AF_UNIX for connection via Unix socket) and then reading output from a
      process. Successfully started httpd.py prints a path to a Unix socket or
      a pair of IP address and network port split with ":".
      
      With proposed patch test has passed 1000 times without any problems.
      Tests previously marked as "fragile" are passed too:
      
      ./test/test-run.py --builddir=$(pwd)/build box-tap/net.box.test.lua \
      	box-tap/cfg.test.lua box-tap/session.storage.test.lua \
      	box-tap/session.test.lua app-tap/tarantoolctl.test.lua \
      	app-tap/debug.test.lua app-tap/inspector.test.lua \
      	app-tap/logger.test.lua app-tap/transitive1.test.lua \
      	app-tap/csv.test.lua app-luatest/http_client_test.lua
      
      P.S. The problem with "fragile" tests is that rerunning hides other
      problems. [1] is about "Address already in use" and [2] is about hangs
      in test. I made a pull request with changes in http client module and
      triggered CI run. Job has been passed, but in log [3] I see three test
      restarts due to fails in http_client test related to my changes.
      
      1. https://github.com/tarantool/tarantool-qa/issues/186
      2. https://github.com/tarantool/tarantool-qa/issues/31
      3. https://github.com/tarantool/tarantool/runs/7726358823?check_suite_focus=true
      
      Closes https://github.com/tarantool/tarantool-qa/issues/186
      Closes https://github.com/tarantool/tarantool-qa/issues/31
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=testing
      02fae15a
  13. Aug 16, 2022
    • Ilya Verbin's avatar
      fiber: do not crash on concurrent fiber:join() · 8f4538cb
      Ilya Verbin authored
      If two or more fibers are yielding in fiber_join_timeout(), one of them
      will eventually join and recycle the fiber, while the rest will crash
      on accessing the recycled fiber's struct. Fix this by doing fiber_find()
      again after each waiting attempt in lbox_fiber_join().
      
      Closes #7489
      Closes #7531
      
      NO_DOC=bugfix
      8f4538cb
  14. Aug 15, 2022
    • Ilya Verbin's avatar
      test: extend the fiber.info() backtraces test · fc11ce06
      Ilya Verbin authored
      Test that an expected Lua function can be found in one of frames.
      C function is already covered by this test.
      
      Closes #7535
      
      NO_DOC=test
      NO_CHANGELOG=test
      fc11ce06
    • Ilya Verbin's avatar
      cmake: normalize ENABLE_BACKTRACE option · 3a6021ea
      Ilya Verbin authored
      CMake accepts the following case-insensitive values as true: 1, ON, YES,
      TRUE, Y, or a non-zero number (including floating point numbers). This
      complicates the parsing of ENABLE_BACKTRACE in `tarantool.build.options`.
      Fix this by defining it to TRUE for any true value.
      
      Part of #7535
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      3a6021ea
  15. Aug 09, 2022
    • Gleb Kashkin's avatar
      console: fix -i being overruled by !isatty() · 9965e3fe
      Gleb Kashkin authored
      The interactive mode has been ignored when stdin was not a tty and is no
      more. Now results of another command can be handled by tarantool.
      Before the patch:
      ```
      $ echo 42 | tarantool -i
      LuajitError: stdin:1: unexpected symbol near '42'
      fatal error, exiting the event loop
      ```
      
      After the patch:
      ```
      $ echo 42 | tarantool -i
      Tarantool 2.5.0-130-ge3cf64a6c
      type 'help' for interactive help
      tarantool> 42
      ---
      - 42
      ...
      
      ```
      
      Closes #5064
      
      NO_DOC=bugfix
      9965e3fe
  16. Aug 01, 2022
    • Andrey Saranchin's avatar
      fiber: introduce fiber slice · e9bd2250
      Andrey Saranchin authored
      This patch introduces execution time slice for fiber. Later, we will use
      this mechanism to limit iteration in space.
      
      Part of #6085
      
      NO_CHANGELOG=see later commits
      NO_DOC=see later commits
      e9bd2250
    • Alexander Turenko's avatar
      fiber_channel: add accessor to internal functions · 395c30e8
      Alexander Turenko authored
      The Rust module [1] leans on several internal symbols. They were open in
      Tarantool 2.8 (see #2971 and #5932), but never were in the public API.
      Tarantool 2.10.0 hides the symbols and we need a way to get them back to
      use in the module.
      
      We have the following options:
      
      1. Design and expose a module API for fiber channels.
      2. Export the symbols with a prefix like `tnt_internal_` (to don't spoil
         the global namespace).
      3. Provide a `dlsym()` alike function to get an address of an internal
         symbol for users who knows what they're doing.
      
      I think that the third way offers the best compromise between amount of
      effort, quality of the result and opportunities to extend. In this
      commit I hardcoded the list of functions to make the change as safe as
      possible. Later I'll return here to autogenerate the list.
      
      Exported the following function from the tarantool executable:
      
      ```c
      void *
      tnt_internal_symbol(const char *name);
      ```
      
      I don't add it into the module API headers, because the function is to
      perform a dark magic and we don't suggest it for users.
      
      While I'm here, added `static` to a couple of fiber channel functions,
      which are only used within the compilation unit.
      
      [1]: https://github.com/picodata/tarantool-module
      
      Part of #7228
      Related to #6372
      
      NO_DOC=don't advertize the dangerous API
      NO_CHANGELOG=don't advertize the dangerous API
      395c30e8
  17. Jul 14, 2022
    • Nikolay Shirokovskiy's avatar
      console: use streams in binary console · 29542070
      Nikolay Shirokovskiy authored
      Now we can make interactive transactions like in case of
      local or txt remote consoles if peer supports streams.
      
      Closes #7413
      
      NO_DOC=minor change
      29542070
    • Nikolay Shirokovskiy's avatar
      console: rollback txn on eval error if begin was in expr · b013233f
      Nikolay Shirokovskiy authored
      The issue is if in binary remote console a error is thrown in expression
      like "box.begin() error('something') box.commit()" then it is
      overwritten by iproto check for active transactions at the end of eval.
      The solution is to rollback active transaction in this case in console
      code before iproto check.
      
      Let's also assert in tests a behaviour that after successful transaction
      begin it stays active in next evaluations (successful or not) until
      explicit rollback.
      
      Closes #7288
      
      NO_DOC=minor change
      b013233f
  18. May 30, 2022
    • Oleg Babin's avatar
      fiber: don't skip fiber_obj:info() arguments · 0eac13b9
      Oleg Babin authored
      Commit b18dd47f ("Introduce backtrace=true option to fiber.info()")
      introduced a way to skip backtraces in fiber.info() calls.
      Commit 9da7e03e ("fiber: introduce fiber_o:info() and fiber_o:csw()")
      introduced `options` function for fiber object however it ignored
      passed options.
      This patch fixed it. Currently fiber:info({backtrace = false})
      returns info without backtrace.
      
      Closes #7210
      
      NO_DOC=bugfix
      0eac13b9
  19. May 22, 2022
  20. May 04, 2022
    • Nikita Pettik's avatar
      prbuf: fix "wrong argument type" error · f715e36a
      Nikita Pettik authored
      ffi.typeof() returns cdata, which in turn can't be concatenated with string
      without explicit call of `tostring`. Moreover, passing data of native Lua
      type would also generate wrong error. So let's simply raise general error
      without mentioning passed type.
      
      NO_DOC=<Internal fix>
      NO_CHANGELOG=<Internal fix>
      f715e36a
  21. Apr 25, 2022
    • Nikita Pettik's avatar
      lua/prbuf: introduce entry:data() method · de90e54b
      Nikita Pettik authored
      prbuf entry contains pointer to raw memory (char *) and its length.
      Let's introduce :data() methods which would convert this memory chunk
      to Lua string.
      
      NO_DOC=<Feature for internal usage>
      NO_CHANGELOG=<Feature for internal usage>
      de90e54b
  22. Apr 22, 2022
  23. Apr 19, 2022
    • Georgiy Lebedev's avatar
      core: introduce parent backtrace collection · 3116c4e7
      Georgiy Lebedev authored
      With backtrace implementation reworked in afc100d, we can now
      efficiently collect unwinding information about parents at fiber
      creation time:
      
      * Add `core_backtrace_cat` helper for concatenating backtraces.
      * Add 'parent_bt' field to `struct fiber` for storing fiber parent's
        backtrace.
      * Add `fiber_parent_backtrace_enabled` and corresponding C/Lua toggles for
        controlling parent backtrace collection for newly created fibers.
      
      Closes #4002
      
      @TarantoolBot document
      Title: new handles for fiber parent backtrace feature
      
      local fiber = require('fiber')
      local log = require('log')
      local yaml = require('yaml')
      
      local function foo()
          log.info("%s", yaml.encode(fiber.info()[fiber.self()[id]].backtrace))
      end
      
      -- Parent backtrace collection feature is disable by default.
      fiber.parent_backtrace_enable()
      -- Backtrace will contain also parent's backtrace.
      fiber.create(foo)
      
      fiber.parent_backtrace_disable()
      -- Backtrace will not contain parent's backtrace.
      fiber.create(foo)
      
      local function bar()
          -- Fibers created before enabling parent backtrace feature will not be
          -- contained in backtrace.
          fiber.parent_backtrace_enable()
          fiber.create(foo)
      end
      
      -- Grandchild will not contain child's backtrace.
      fiber.create(bar)
      3116c4e7
  24. Apr 13, 2022
    • Nikita Pettik's avatar
      lua: introduce interface for prbuf · c53a45ec
      Nikita Pettik authored
      Simply add Lua wrappers for recently introduced prbuf.
      
      Introduce new buffer (in addition to ibuf) - prbuf. "pr" stands for
      "partitioned ring-". It save all metadata in the same memory chunk
      provided for storage, so it can be completely restored from the 'raw'
      memory. API:
      
      ```
      -- mem is a chunk of raw (char *) memory, of size mem_size.
      -- It is used for data storage. Note that available space is of less
      -- size due to prbuf metadata overhead.
      -- Returns handle to prbuf.
      --
      require('buffer').prbuf_create(mem, mem_size)
      
      -- mem is a chunk of memory, which contains already created prbuf.
      -- It implies that once prbuf_create() was called with the same memory.
      -- If mem does not contain valid buffer - raise an appropriate error.
      require('buffer').prbuf_open(mem)
      
      -- Returns continuous chunk of memory with given size. May return nil
      -- in case if requested chunk is too large. Note that after copying
      -- object to returned chunk, it should be committed with prbuf:commit();
      -- otherwise :prepare() may return the same chunk twice.
      prbuf:prepare(size)
      
      -- Commits the last prepared chunk. Undefined behaviour in case of
      -- committing the same chunk twice.
      prbuf:commit()
      
      -- Create and return prbuf_iterator. Does not fail. Created iterator
      -- points to nowhere - it should be adjusted with :next() call to
      -- the first entry.
      prbuf:iterator_create()
      
      -- Advance iterator position. Returns prbuf_entry or nil in case
      -- iterator has reached the end. Entry consists of two members:
      -- size and ptr. The last one is an array of characters of given size.
      iterator:next()
      ```
      
       Usage examples:
      
      ```
      
      local ibuf = buffer.ibuf()
      local prbuf_size = 100
      local memory = ibuf:alloc(prbuf_size)
      local prbuf = buffer.prbuf_create(memory, prbuf_size)
      
      local sample_size = 4
      local raw = prbuf:prepare(4)
      if raw == nil then
          -- allocation size is too large, try smaller.
      end
      raw[0] = ...
      ...
      raw[3] = ...
      prbuf:commit()
      local prbuf_recovered = buffer.prbuf_open(memory)
      local iter = prbuf_recovered:iterator_create()
      local entry = iter:next()
      assert(tonumber(entry.size) == 4)
      -- Check values stored in the buffer.
      assert(entry.ptr[0] == ...)
      entry = iter:next()
      -- Our buffer has only one entry.
      assert(entry == nil)
      
      ```
      
      NO_DOC=<Feature for internal usage>
      NO_CHANGELOG=<Feature for internal usage>
      c53a45ec
  25. Apr 07, 2022
    • Ilya Verbin's avatar
      app: fix crash with multiple -e -l options · bb3ed321
      Ilya Verbin authored
      Tarantool used to crash if launched with multiple -e or -l options without
      a space between the option and the value, e.g.: `tarantool -ea -eb`.
      It happened because optv[] was allocated for argc==3 items, while 4
      options were written to it after parsing (-e, a, -e, b).
      This patch allocates optv[] for the maximum possible number of options:
      (argc - 1) * 2.
      
      Closes #5747
      
      NO_DOC=bugfix
      bb3ed321
  26. Mar 29, 2022
    • Igor Munkin's avatar
      lua: rewrite crc32 digest via Lua C API · 6b913198
      Igor Munkin authored
      As a result of recording <crc32:update> method or <digest.crc32>
      function wrong semantics is compiled (strictly saying, the resulting
      trace produces the different result from the one yielded by
      interpreter). The easiest solution is disabling JIT for particular
      functions, however, such approach drops the overall platform
      performance. Hence, the mentioned functions are rewritten line by line
      via Lua C API to avoid JIT misbehaviour.
      
      NO_DOC=no visible changes
      NO_CHANGELOG=no visible changes
      6b913198
  27. Mar 25, 2022
    • Yaroslav Lobankov's avatar
      test: fix flaky test_cancel_and_errinj · a5557281
      Yaroslav Lobankov authored
      This change tries to fix the following sporadic test error:
      
          [007] not ok 4	http_client.sock_family:"AF_INET".test_cancel_and_errinj
          [007] #   ...arantool/tarantool/test/app-luatest/http_client_test.lua:221: Timeout check - status
          [007] #   expected: 408, actual: 200
      
      Fixes tarantool/tarantool-qa#154
      
      NO_DOC=testing
      NO_TEST=testing
      NO_CHANGELOG=testing
      a5557281
  28. Mar 18, 2022
    • Sergey Ostanevich's avatar
      console: introduce __autocomplete metamethod · 7817fc13
      Sergey Ostanevich authored
      This patch updates the logic in lua_rl_complete() where __index from
      a metatable apparently expected to be a table, not a function. It is
      rather simple for a table object, but some of them are userdata, so
      an __autocomplete method is introduced to be sure it returns a table
      with all names suitable for tabcompletion.
      
      Part of #6305
      NO_DOC=internal
      NO_CHANGELOG=part of a fix
      7817fc13
  29. Mar 14, 2022
    • Vladimir Davydov's avatar
      msgpack: add iterator.take_array · 68bf3885
      Vladimir Davydov authored
      NO_CHANGELOG=feature was not released
      
      Closes #6823
      
      @TarantoolBot document
      Title: Document msgpack object iterator take_array method
      
      The new method copies the given number of msgpack values starting from
      the iterator cursor position to a new msgpack array object. On success
      it returns the new msgpack object and advances the iterator cursor. If
      there isn't enough values to decode, it raises a Lua error and leaves
      the iterator cursor unchanged.
      
      This function could be implemented in Lua like this:
      
      ```lua
      function take_array(iter, count)
          local array = {}
          for _ = 1, count do
              table.insert(array, iter:take())
          end
          return msgpack.object(array)
      end
      ```
      
      Usage example:
      
      ```lua
      local mp = msgpack.object({10, 20, 30, 40})
      local it = mp:iterator()
      it:decode_array_header()       -- returns 4
      it:decode()                    -- returns 10
      local mp2 = it:take_array(2)
      mp2:decode()                   -- returns {20, 30}
      it:decode()                    -- returns 40
      ```
      68bf3885
Loading