Skip to content
Snippets Groups Projects
  1. Dec 10, 2019
    • Vladislav Shpilevoy's avatar
      func: fix not unloading of unused modules · ca07088c
      Vladislav Shpilevoy authored
      C functions are loaded from .so/.dylib dynamic libraries. A
      library is loaded when any function from there is called first
      time. And was supposed to be unloaded, when all its functions are
      dropped from the schema (box.schema.func.drop()), and none of them
      is still in a call. But the unloading part was broken.
      
      In fact, box.schema.func.drop() never unloaded anything. Moreover,
      when functions from the module were added again without a restart,
      it led to a second mmap of the same module. And so on, the same
      library could be loaded any number of times.
      
      The problem was in a useless flag in struct module preventing its
      unloading even when it is totally unused. It is dropped.
      
      Closes #4648
      ca07088c
  2. Nov 21, 2019
    • Vladislav Shpilevoy's avatar
      func: fix use after free on function unload · fa2893ea
      Vladislav Shpilevoy authored
      Functions are stored in lists inside module objects. Module
      objects are stored in a hash table, where key is a package name.
      But the key was a pointer at one of module's function definition
      object. Therefore, when that function was deleted, its freed
      package name memory was still in the hash key, and could be
      accessed, when another function was deleted.
      
      Now module does not use memory of its functions, and keep a copy
      of the package name.
      fa2893ea
  3. Jun 24, 2019
    • Kirill Shcherbatov's avatar
      box: rework func object as a function frontend · 5b3e0551
      Kirill Shcherbatov authored
      The function func object used to provide a call method only for
      C functions. In scope of this patch it reworked to be a uniform
      function call frontend both for C and Lua functions.
      
      Introduced classes func_c and func_lua, that provide own
      constructors which produce implementation-specific object with
      call and destroy methods.
      
      Needed for #4182, #1260
      5b3e0551
    • Kirill Shcherbatov's avatar
      box: rework box_lua_{call, eval} to use input port · 707e58a3
      Kirill Shcherbatov authored
      Re-factor box_lua_call and box_lua_eval so that they don't take
      call_request. This approach is more scalable: in case of a
      functional index, the user expects to see a tuple with field
      names so we should be able to pass not only raw msgpack, but
      also a tuple to a Lua call so we need an universal way to pass
      arguments to _call methods.
      
      To pass a tuple msgpack introduced a new port_msgpack: the port
      class with dump_lua method.
      A new method get_msgpack returns a content of a port as a
      msgpack data. The lifecycle of the returned value is
      implementation-specific: it may either be returned directly from
      the port, in which case the data will stay alive as long as the
      port is alive, or it may be allocated on the fiber()->gc, in
      which case the caller is responsible for cleaning up.
      
      Needed for #4182, #1260
      707e58a3
    • Kirill Shcherbatov's avatar
      box: rework func cache update machinery · d026b546
      Kirill Shcherbatov authored
      Tarantool used to assume that func_new call must not fail and
      it used to build a new func object by given definition just on
      func cache replace operation. We need to fix it to perform
      user-dependent risky actions like Lua function assemble in
      further patches.
      
      The replace method is disallowed for _func space because it is
      redundant and difficult to maintain in case of functions that
      have pre-compiled runtime.
      
      Needed for #4182, #1260
      d026b546
  4. Jul 13, 2018
    • Kirill Shcherbatov's avatar
      box: support reload whole module · 3aec485d
      Kirill Shcherbatov authored
      Closes #2946.
      
      @TarantoolBot document
      Title: fixed module reload
      There was a bug in tarantool documentation:
      https://tarantool.io/en/doc/1.7/book/box/
      box_schema/#lua-function.box.schema.func.reload
      Now it is allowed to reload all functions in loadable
      module via one method. Legacy method including finction
      name is forbidden.
      box.schema.func.reload("utils")       -- ok since now
      box.schema.func.reload("utils.func1") -- forbidden since now
      
      Global reload is still unsupported because it seems
      to be useless.
      box.schema.func.reload()              -- invalid!
      3aec485d
  5. Aug 24, 2017
  6. Aug 15, 2017
    • Georgy Kirichenko's avatar
      Add hot function reload for C procedures · 96938faf
      Georgy Kirichenko authored
      This patch adds ability to reload C procedures on the fly without
      downtime. To achive that, Tarantool loads a new copy of shared
      library and starts routing all new request to the new version.
      The previous version remains active until all started calls
      are finished. All shared libraries are loaded with RTLD_LOCAL,
      therefore two or more copies can co-exist without any problems.
      From now box loads all external modules via an unique symlink to
      avoid caching inside dlopen().
      
      If one of some module function is reloaded then all other functions
      from this module will be reloaded.
      
      Reviewed and heavily patched by Roman Tsisyk.
      
      Closes #910
      96938faf
  7. Aug 09, 2017
  8. Jun 19, 2017
  9. May 20, 2016
  10. Nov 27, 2015
  11. Nov 26, 2015
    • Roman Tsisyk's avatar
      Refactor box/lua/call.cc · c239235e
      Roman Tsisyk authored
      * Extract high-level IPROTO_CALL code to box.cc
      * Move execute_c_call to func.cc
      * Prepare src/lua/call.cc to rewrite in C
      
      Incompatible changes:
      
      * #300 logic was reverted. An attempt to call an unexisting Lua function
        without universal execute permissions now cause "access denied" message
        instead of "function does not exist".
      
        Since there is no cache for Lua procedures, existence of a function can be
        checked only by attempt to execute it. Caller **must** have a permission
        to execute function in order to execute functions. It's obvious, isn't it?
      
        Anyway, this patch doesn't affect user experience with using stored
        procedures. The two steps still must be performed to allow Lua calls
        using the binary protocol:
          1. A function must be defined in Lua
          2. A function must be declared in box.schema and caller must have
             execute permission for this object or for entire "universe".
        The order actually doesn't matter - the both steps must be done.
      c239235e
  12. Aug 14, 2015
    • Roman Tsisyk's avatar
      Fix #897: Introduce a public C API for stored functions in C and plugins · 316d4e3a
      Roman Tsisyk authored
      Introduce a layer of wrappers for a number of internal box functions,
      dealing with accss to spaces and indexes.
      
      These wrappers:
          * don't throw exceptions
          * have a common prefix box_
          * are exported in the server development headers
      
      Rewrite Lua C bindings to use the public API described above.
      Rewrite Lua FFI bindings to do the same.
      Add test.
      316d4e3a
  13. Aug 12, 2015
  14. Jul 06, 2015
    • Konstantin Osipov's avatar
      gh-897: stored functions in C/C++ · fccb62ce
      Konstantin Osipov authored
      Implement basic support for stored functions in C/C++.
      
      - split away struct func from struct func_def (function
      object and function definition object).
      - extend box.schema.func.create() to accept 'language' argument.
      - move module API related cmake magic to its own file
      - add test/lib to gitignore
      - update to the new test-run
      - add a test
      fccb62ce
  15. Feb 20, 2015
  16. Jan 19, 2015
    • Roman Tsisyk's avatar
      Implement EVAL request · 43439a0d
      Roman Tsisyk authored
      Add a new IPROTO request type - EVAL. EVAL compiles and executes arbitrary
      Lua expression and returns raw result (without converting it to a list
      of tuples).
      43439a0d
  17. Jan 13, 2015
  18. Jul 13, 2014
    • Konstantin Osipov's avatar
      A pre-requisite patch for multi-statement transactions. · 1d1b8953
      Konstantin Osipov authored
      Refactor statement transaction lifecycle. Avoid nested
      statement transactions. Make sure there is no more than 1
      statement transaction present in the system at the moment.
      
      Resolve the bugs this revealed:
      - in local hot standby we would parasite on the main or
      script fiber session to process requests. When an assert
      was added that there is no more than 1 transaction active
      at a given moment in time, it turned out that transactions
      running on behalf of local hot standby were running in
      the scope of session of the run_script or sched fibers.
      
      Create and use an own session there.
      
      - refactor session on_connect/on_disconnect trigger
      invocation: do not invoke these triggers for just any session,
      only for real connects/disconnects (iproto, admin).
      
      - split session creation/destruction and trigger invocation
      Conclude that session storage implementation needs to be
      done differently.
      1d1b8953
  19. Mar 03, 2014
  20. Feb 03, 2014
    • Roman Tsisyk's avatar
      Optimize Lua/C bindings for box · 052c147b
      Roman Tsisyk authored
      This patch add specialized versions of box.process for select, insert,
      replace, update and delete requests. This optimization reduces the
      number of Lua <-> C switches during request processing. New functions
      create struct request directly without allocating temporary buffer for
      entire request body.
      052c147b
  21. Dec 17, 2013
  22. Aug 21, 2013
    • Konstantin Osipov's avatar
      Modify format of server snapshot to version 12. · a28c57bf
      Konstantin Osipov authored
      The new server snapshot format is identical to format of
      XLOG, i.e. it contains REPLACE statements with BOX_INSERT
      flags for every tuple in a space.
      
      This allows to streamline recovery, since rows from a snapshot
      can be treated the same as rows from the write ahead log (XLOG).
      
      This is an incompatible change:
       - tarantool 1.5 won't be able to read data of tarantool 1.6
       - tarantool 1.6, without extra effort, won't be able
       to read data of tarantool 1.5 (a conversion procedure is needed).
      
       This change as such doesn't break replication, but further changes
      are in the pipeline which will inevitably finish this matter up as well.
      
      Why this patch is necessary
      ---------------------------
      
      To create system spaces dict-v5 branch employs on_replace triggers
      mechanism, fired off by txn_replace(). Thus it's vital that all changes
      go into spaces using txn_replace().
      
      What else this patch does
      -------------------------
      
      - since now XLOG and SNAP have the same format, log_io.cc
      code has become a bit simpler
      - struct key_def is re-factored to simplify dynamic creation/deletion
      of keys
      - reference counting for tuple formats is added
      - a number of error messages is improved to provide part no
      in a multipart key.
      - space cache is split away from space.cc into a separate
      module, schema.[h,cc]
      a28c57bf
  23. Jul 18, 2013
  24. Nov 29, 2012
  25. Nov 28, 2012
  26. Oct 14, 2012
  27. Sep 06, 2012
  28. Sep 04, 2012
  29. Aug 29, 2012
  30. Aug 28, 2012
Loading