Skip to content
Snippets Groups Projects
  1. Oct 25, 2017
  2. Oct 24, 2017
  3. Oct 19, 2017
    • Konstantin Nazarov's avatar
      Add support for tarantoolctl rocks make · 2427c360
      Konstantin Nazarov authored
      luarocks make <rockspec> allows one to build a rock from local
      directory.
      
      In addition to the "rocks make" argument, one additional option is
      needed in tarantoolctl: --chdir. This is because we need to build
      inside the rock directory, but output the result to
      <project_root>/.rocks.
      
      Implements #2846
      2427c360
    • Vladimir Davydov's avatar
      Fix compilation on Mac OS · 39276fe1
      Vladimir Davydov authored
      > src/box/txn.c:454:40: error: '_Alignof' applied to an expression is a GNU extension [-Werror,-Wgnu-alignof-expression]
      >                 diag_set(OutOfMemory, sizeof(*svp) + alignof(*svp) - 1,
      >                                                      ^
      
      Do not try to be smart and guess allocation size using alignof.
      
      > src/box/memtx_tree.c:391:11: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
      >         if (type < 0 || type > ITER_GT) { /* Unsupported type */
      >             ~~~~ ^ ~
      
      > src/box/vinyl_index.c:184:29: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
      >         if (type > ITER_GT || type < 0) {
      >                               ~~~~ ^ ~
      
      Move the check for illegal params (i.e. 'type < 0') to the box API.
      In index callbacks, only check that the iterator type is supported
      by the index.
      39276fe1
    • Vladimir Davydov's avatar
      index: introduce and use internal iterator API · d4d6b613
      Vladimir Davydov authored
      Since we already have the index_create_iterator() method to create an
      iterator, the API basically consists of two functions: iterator_next()
      and iterator_delete(). While iterator_delete() is just a trivial wrapper
      around iterator::free callback, iterator_next() is more than that: it
      also checks schema version and invalidates the iterator in case there
      was a DDL that affected the index. Previously, this was done only by the
      box API, but the overhead of this check seems to be really negligible so
      it is compelling to do it from the internal API so that an internal API
      user doesn't need to care about DDL once he opened an iterator.
      
      Needed for #2776
      d4d6b613
    • Vladimir Davydov's avatar
      space: drop execute_select virtual method · f1a75fe4
      Vladimir Davydov authored
      This virtual method was added to make use of the 'position' optimization
      implemented in memtx. Since the optimization was removed recently, we
      don't need it anymore.
      f1a75fe4
    • Vladimir Davydov's avatar
      index: implement generic versions of min(), max(), and count() · 4e3bb53e
      Vladimir Davydov authored
      The primary reason for these methods to be implemented differently
      for memtx and vinyl was the 'position' optimization exploited by
      the memtx engine: since selects from memtx do not yield, we could
      use a preallocated iterator there.
      
      Now, as the 'position' optimization became redundant and was
      removed due to the switch to memory pools for iterator allocations,
      the only idiosyncrasy left in the memtx implementation is the count()
      optimization: count() falls back on size() for ITER_ALL. Since this
      optimization consists of just a few lines of code, we don't really
      need memtx_index_count() co-used by all memtx index implementations:
      we can implement it in each memtx index separately.
      
      That being said, let us:
       - implement generic versions of min(), max(), and count();
       - make vinyl, memtx, and sysview engines use generic versions of
         the above-mentioned methods if appropriate;
       - Remove memtx_index.[hc]
      
      As a side-effect, this patch enables min(), max(), and count() in
      the sysview engine, but that is not bad considering that this engine
      implements general-purpose iterator for its indexes.
      4e3bb53e
    • Vladimir Davydov's avatar
      index: simplify iterator creation API · e18acfaa
      Vladimir Davydov authored
      We don't need index_position() optimization any more as all iterators
      are allocated from memory pools. Remove it and merge iterator allocation
      and initialization procedures.
      
      Needed for #2776
      e18acfaa
    • Vladimir Davydov's avatar
      index: allocate iterators from memory pools · 3273006d
      Vladimir Davydov authored
      Currently, index iterator allocation and initialization are separated.
      This is done in order to speed up iterator creation when the caller
      does not yield: there's 'position' method, which returns a preallocated
      iterator and can be used instead of costly 'alloc'; the iterator
      returned by this method needs to be initialized just like an iterator
      allocated normally, via 'alloc'. This looks ugly, because 'position'
      is engine-dependent, e.g. it can't be used in case of vinyl, because
      vinyl yields internally.
      
      Let's allocate all index iterators from memory pools. Since allocation
      from a memory pool is very cheap, this will allow us to get rid of the
      above-mentioned 'position' hack and simplify the iterator API.
      3273006d
    • Vladimir Davydov's avatar
      index: store pointer to engine · 0cd2240c
      Vladimir Davydov authored
      Currently, index iterator allocation and initialization are separated.
      This is done in order to speed up iterator creation when the caller
      does not yield: there's 'position' method, which returns a preallocated
      iterator and can be used instead of costly 'alloc'; the iterator
      returned by this method needs to be initialized just like an iterator
      allocated normally, via 'alloc'. This looks ugly, because 'position'
      is engine-dependent, e.g. it can't be used in case of vinyl, because
      vinyl yields internally.
      
      We can get rid of the above-mentioned 'position' hack by simply using a
      mempool for allocating iterators. To do that, we need to access engine
      from index, so this patch adds a reference to struct engine to struct
      index.
      0cd2240c
    • Vladimir Davydov's avatar
      Rewrite box DML/DQL API implementation without try/catch · 05ec9dd8
      Vladimir Davydov authored
      Box functions were initially written as C wrappers around internal C++
      API so they used try/catch to propagate errors. Now we can rewrite them
      without try/catch, as we have C API for DML/DQL.
      05ec9dd8
    • Vladimir Davydov's avatar
      txn: internal API: rollback on begin/commit failure · 84b7d542
      Vladimir Davydov authored
      Current internal tnx API is not particularly user-friendly in regards to
      error handling: if txn_begin_stmt(), txn_commit_stmt(), or txn_commit()
      fails, the txn state is undefined and the caller must rollback manually.
      To make the API easier to use, let's oblige these function rollback
      automatically in case of failure.
      
      Needed for #2776
      84b7d542
    • Vladimir Davydov's avatar
      space: fold request mangling in internal API · 0788f5e9
      Vladimir Davydov authored
      Apart from executing a request, process_rw() may also:
       - replace nil with a sequence value;
       - rebind update to the primary key.
      
      Let's fold this logic in the internal space API so that it can
      be easily reused by SQL.
      
      Note, request_rebind_to_primary_key() must not fail, because
      it is called after the request was successfully executed,
      which implies that the engine performed all necessary checks,
      so replace exceptions with asserts there.
      
      Needed for #2776
      0788f5e9
  4. Oct 18, 2017
  5. Oct 15, 2017
    • Vladimir Davydov's avatar
      engine: convert to C · f809b4b5
      Vladimir Davydov authored
      Needed for #2776
      f809b4b5
    • Vladimir Davydov's avatar
      space: convert to C · abfdbb30
      Vladimir Davydov authored
      Needed for #2776
      abfdbb30
    • Vladimir Davydov's avatar
      txn: convert to C · e162acd2
      Vladimir Davydov authored
      Needed for #2776
      e162acd2
    • Vladimir Davydov's avatar
      txn: add xc suffix to all public functions that may throw · 04185bef
      Vladimir Davydov authored
      Preparation for converting txn to C.
      
      This will help removing exceptions from txn methods.
      
      Needed for #2776
      04185bef
    • Vladimir Davydov's avatar
      trigger: make trigger_run() exception safe · 79f05762
      Vladimir Davydov authored
      To convert engine and space infrastructure to C, we need to make txn
      usable from C code. The only reason why we can't convert txn.cc to C
      right now is triggers: they are set from alter.cc and may throw
      exceptions. To handle this, let's make trigger_run() catch all
      exceptions and return an error code instead. For C++ code, introduce
      trigger_run_xc() which calls trigger_run() under the hood and throws
      the exception suppressed by it.
      
      Needed for #2776
      79f05762
    • Vladimir Davydov's avatar
      engine: do not throw exceptions from engine callbacks · 424d786e
      Vladimir Davydov authored
      Preparation for converting engine implementation to C.
      
      Needed for #2776
      424d786e
    • Vladimir Davydov's avatar
      schema: make space_foreach() usable in C code · e6be2d71
      Vladimir Davydov authored
       - Add a return code to both space_foreach() and its callback so that
         the caller can use it to propagate errors instead of throwing
         exceptions.
       - Make space_foreach() exception-free.
       - Export the function to C.
      
      Preparation for converting engine implementation to C.
      
      Needed for #2776
      e6be2d71
    • Vladimir Davydov's avatar
      engine: add xc suffix to public methods that may throw · a65d7f9b
      Vladimir Davydov authored
      Preparation for converting engine implementation to C.
      
      This will help removing exceptions from engine callbacks.
      
      Needed for #2776
      a65d7f9b
    • Vladimir Davydov's avatar
      vinyl: remove return code from functions updating config · 006e52a7
      Vladimir Davydov authored
      vy_set_timeout() and vy_set_max_tuple_size() are not supposed to fail.
      Remove the return code and diag_raise() in the engine wrapper.
      006e52a7
    • Vladimir Davydov's avatar
      engine: convert to plain struct · 07b07ca2
      Vladimir Davydov authored
      Needed for #2776
      07b07ca2
    • Vladimir Davydov's avatar
      engine: add wrappers around class methods · 47bab946
      Vladimir Davydov authored
      Preparation for converting class Engine to plain struct.
      
      Needed for #2776
      47bab946
    • Vladimir Davydov's avatar
      Rework space creation · 34b1e679
      Vladimir Davydov authored
      engine::createFormat() wasn't such a good idea after all - it's
      difficult to convert it to C in a neat way: the problem is it may
      return NULL on success (which it does in case of sysview engine)
      so to make it exception-free we have to either return the format
      in an extra argument or allow the engine set this method to NULL.
      Both ways look ugly.
      
      Let's remove engine::createFormat() and oblige engine::createSpace()
      fully initialize a space, similarly to how it works for indexes. To
      ease its work, introduce space_create() which initializes engine
      independent fields (i.e. struct space).
      
      While we are at it, let's also
       - make memtx/vinyl space_vtab private to the engines and export
         functions to create a memtx/vinyl space;
       - make struct space initialization code exception-free - after all
         we are going to convert it to C.
      
      Needed for #2776
      34b1e679
    • Vladimir Davydov's avatar
      Cleanup vinyl engine initialization · f8978783
      Vladimir Davydov authored
      Vinyl engine initialization is done in two steps: first we create the
      engine class and then we call ->init() method, which creates vinyl
      environment. There's no reason not to create the environment right in
      the engine class constructor, so let's move it there and drop ->init().
      Also, let's pass engine parameters to the engine constructor, just like
      we do in case of memtx, instead of reading the config from the engine
      implementation.
      f8978783
    • Vladimir Davydov's avatar
      Cleanup engine lookup · 97b326ff
      Vladimir Davydov authored
      To find an engine object, we always use engine_find(), which raises an
      error if the engine was not found. Sometimes we know for sure that the
      engine we are looking for exists, in which case we don't need to raise
      an error. Let's introduce engine_by_name() that just looks up the engine
      and does nothing else and use it when we are sure that the engine must
      exist.
      97b326ff
    • Vladimir Davydov's avatar
      Rename Engine to engine · 98e2e085
      Vladimir Davydov authored
      Rename MemtxEngine, VinylEngine, and SysviewEngine to memtx_engine,
      vinyl_engine, and sysview_engine as well.
      
      Preparation for converting class Engine to plain struct.
      
      Needed for #2776
      98e2e085
    • Vladimir Davydov's avatar
      Remove unused error classes · db5af10d
      Vladimir Davydov authored
      IllegalParams and ErrorInjection are not used anymore. Delete them.
      db5af10d
    • Vladimir Davydov's avatar
      space: do not throw exceptions from engine callbacks · c4b7f928
      Vladimir Davydov authored
      Preparation for converting space implementation to C.
      
      Needed for #2776
      c4b7f928
    • Vladimir Davydov's avatar
      space: add xc suffix to public functions that may throw · 03774ba3
      Vladimir Davydov authored
      There are four such functions declared in space.h:
      
        space_new
        index_find_unique
        index_find_system
        access_check_space
      
      index_find_unique() and access_check_space() are used in the code that
      is about to be converted to C so for them add exception-free variants
      (without xc suffix).
      
      Preparation for converting space implementation to C.
      
      Needed for #2776
      03774ba3
    • Vladimir Davydov's avatar
      space: zap space_size() · a3c731ea
      Vladimir Davydov authored
      This function is very unreliable:
       - it crashes if the space doesn't have indexes;
       - it only works for memtx spaces, for other engines
         it throws an exception.
      
      Since it is only used in memtx, let's zap it and call index_size()
      directly.
      a3c731ea
    • Vladimir Davydov's avatar
      space: add wrappers around virtual methods · 5fd9e5cd
      Vladimir Davydov authored
      Preparation for converting space implementation to C.
      
      Note, all methods that may throw have *_xc suffix.
      This will help removing exceptions from space callbacks.
      
      Needed for #2776
      5fd9e5cd
    • Vladimir Davydov's avatar
      index: convert engine dependant code to C · 710d5c0b
      Vladimir Davydov authored
      Needed for #2776
      710d5c0b
    • Vladimir Davydov's avatar
      index: remove exceptions from index_build() · ae98b418
      Vladimir Davydov authored
      Add index_build_xc() wrapper for C++ code.
      
      Preparation for converting index implementation to C.
      
      Needed for #2776
      ae98b418
    • Vladimir Davydov's avatar
      index: do not throw exceptions from engine callbacks · 50bf3988
      Vladimir Davydov authored
      Preparation for converting index implementation to C.
      
      Needed for #2776
      50bf3988
    • Vladimir Davydov's avatar
      schema: export space_cache_find() to C · c5c45dc7
      Vladimir Davydov authored
      Add space_cache_find_xc() wrapper for C++ code.
      
      Preparation for converting index implementation to C.
      
      Needed for #2776
      c5c45dc7
    • Vladimir Davydov's avatar
      index: convert to plain struct · 1187b586
      Vladimir Davydov authored
      Needed for #2776
      1187b586
Loading