Skip to content
Snippets Groups Projects
  1. Jun 20, 2019
  2. Jun 19, 2019
  3. Jun 18, 2019
    • Vladimir Davydov's avatar
      vinyl: fix assertion failure in vy_tx_handle_deferred_delete · 41219774
      Vladimir Davydov authored
      vy_tx_handle_deferred_delete() expects (righteously) that in case a
      deferred DELETE overwrites a statement in a secondary index write set
      and the overwritten statement wasn't skipped on commit (i.e. doesn't
      have txv->is_overwritten flag set), both the old and the new statement
      must be REPLACEs (see the comment to the corresponding assertions for
      more details).
      
      The problem is we don't set is_overwritten flag in case a statement
      doesn't have any effect (txv->is_nop is set), even if it was, in fact,
      overwritten in the primary index write set (see vy_tx_prepare). As
      a result, we get an assertion failure when we delete such statement
      in the same transaction, e.g.
      
        s = box.schema.space.create('test', {engine = 'vinyl'})
        s:create_index('pk', {parts = {1, 'unsigned'}})
        s:create_index('sk', {parts = {2, 'unsigned'}})
        s:replace{1, 1, 1}
        box.begin()
        s:update(1, {{'+', 3, 1}}) -- adds no-op REPLACE to sk write set
        s:delete(1)                -- produces deferred DELETE for sk
        box.commit()
      
      results in
      
        vy_tx_handle_deferred_delete: Assertion `vy_stmt_type(stmt) == IPROTO_REPLACE' failed.
      
      Fix this by making sure we set is_overwritten for all overwritten
      statements in a secondary index write set.
      
      Closes #4294
      41219774
  4. Jun 14, 2019
    • Ilya Konyukhov's avatar
      app: let user define search root for packages · 4e27b0e6
      Ilya Konyukhov authored
      **Intro**:
      
      By default, Lua uses package.path/cpath to load dependencies when user
      calls `require("something")`. It also allows to add custom loaders to
      extend its functionality. Tarantool transforms default behavior by
      injecting some custom loaders into `package.loaders`.
      
      Firstly, it allows to load modules from CWD. Secondly, it looks for
      rocks modules starting from CWD and traversing up to root "/"
      directory. This "start from CWD" behaviour is hardcoded and not
      customizable.
      
      **Problem**:
      
      Let say we have a lua app with all dependencies under myapp directory.
      If you start your application like this, you won't be able to load any
      of them unless you specify myapp in every require call:
      
      ```bash
      tarantool myapp/init.lua
      ```
      
      To allow user scripts require dependencies relatively, user has to first
      determine appropriate directory path relatively to scripts file and then
      patch package.path/cpath with both modules and rocks paths.
      
      **Solution**:
      
      Introduce the notion of a search root which is used as base for rocks
      and module loaders. Let user easily set this path to control how
      application dependencies are loaded.
      
      There is 2 new functions introduced in this patch:
      - package.setsearchroot(path) is used to set new search root to look
      dependency from
      - package.searchroot() returns search root currently setup. If no search
      root was setup, `fio.cwd()` is returned.
      
      @TarantoolBot document
      Title: Document new package.setsearchroot and package.searchroot
      functions
      
      What this patch does:
      
      `package.setsearchroot(path)` function sets search root which is used
      as root directory to load dependencies from:
      
      - path must be a string (relative or absolute). It will be expanded to
        absolute path and set as a search root;
      - if no path specified, it sets current file directory as a search root
        (using debug.sourcedir);
      - if path is box.NULL, that searchroot will be reset,
        so default behaviour will apply (CWD).
      
      With that said everything a user now has to do is to just put this line
      of code:
      
      ```lua
      package.setsearchroot()
      ```
      
      at the top of project init file "myapp/init.lua" which is placed in the
      project root and start an app by simply calling:
      
      ```bash
      $ tarantool myapp/init.lua
      ```
      
      This will set search root to the absolute path of `myapp` directory, so
      all dependencies will be looked relative to that directory.
      4e27b0e6
  5. Jun 13, 2019
    • Serge Petrenko's avatar
      recovery: remove yields from index build and format check · f824d092
      Serge Petrenko authored
      Iproto already listens for requests during recovery, so yielding at this
      point of time allows such early requests, which arrived during recovery,
      be processed while data is in unfinished state. This caused box/net.box
      test failures, and is potentially harmful.
      Besides, there is no need to yield during recovery.
      
      Closes #4273
      f824d092
    • Serge Petrenko's avatar
      lib/core: introduce decimal type to tarantool · 6d62c6c1
      Serge Petrenko authored
      Add fixed-point decimal type to tarantool core.
      Adapt decNumber floating-point decimal library for the purpose, write a
      small wrapper and add unit tests.
      
      A new decimal type is an alias for decNumber numbers from the decNumber
      library.
      Arithmetic operations (+, -, *, /) and some mathematic functions
      (ln, log10, exp, pow, sqrt) are available together with methods to
      pack and unpack decimal to and from its packed representation (useful
      for serialization).
      
      We introduce a single context for all the arithmetic operations
      on decimals, which enforces both number precision and scale to be
      in range [0, 38]. NaNs and Infinities are restricted.
      
      Part of #692
      6d62c6c1
    • Mergen Imeev's avatar
      sql: set errors in VDBE using diag_set() · 36f3bf4f
      Mergen Imeev authored
      After this patch, all errors in VDBE will be set using diag_set().
      
      Closes #4074
      36f3bf4f
    • Mergen Imeev's avatar
      sql: use diag_set() to set an error in SQL functions · fe718bac
      Mergen Imeev authored
      After this patch, all errors in the SQL functions will be set
      using diag_set().
      
      Part of #4074
      fe718bac
    • Mergen Imeev's avatar
      sql: remove error SQL_MISMATCH · 749fda97
      Mergen Imeev authored
      This patch replaces SQL error SQL_MISMATCH by Tarantool error
      ER_SQL_TYPE_MISMATCH.
      749fda97
    • Mergen Imeev's avatar
      sql: remove error SQL_INTERRUPT · 0e0ed52d
      Mergen Imeev authored
      Since the interrupt system is no longer used in SQL, the
      SQL_INTERRUPT error is out of date and should be removed. Also
      this patch removes currently unused progress callback system.
      0e0ed52d
    • Mergen Imeev's avatar
      sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt · 9cc943f8
      Mergen Imeev authored
      Currently, in OP_Halt, you can get a SQL error other than
      SQL_TARANTOOL_ERROR, for example, the SQL_CONSTRAINT error. After
      this patch, all errors going through OP_Halt will have SQL error
      code SQL_TARANTOOL_ERROR and have diag set.
      
      Part of #4074
      9cc943f8
    • Mergen Imeev's avatar
      sql: remove error ER_SQL · 8af9bd49
      Mergen Imeev authored
      The ER_SQL error code is very similar to the ER_SQL_EXECUTE error
      code: they have almost identical description and usage. To avoid
      misunderstandings, it is better to remove one of them. The ER_SQL
      error code has a slightly more vague description, so it was
      decided to remove it.
      8af9bd49
    • Mergen Imeev's avatar
      sql: remove error codes SQL_TARANTOOL_*_FAIL · 0633eff0
      Mergen Imeev authored
      The error codes SQL_TARANTOOL_DELETE_FAIL,
      SQL_TARANTOOL_ITERATOR_FAIL and SQL_TARANTOOL_INSERT_FAIL have
      practically no functions, but their use can lead to incorrect
      behavior. This patch replaces them with SQL_TARANTOOL_ERROR. This
      will simplify the work with errors.
      0633eff0
    • Mergen Imeev's avatar
      sql: remove mayAbort field from struct Parse · 05b5f099
      Mergen Imeev authored
      Currently, the mayAbort field is working with SQL error
      SQL_CONSTRAINT. Since we want to replace SQL_CONSTRAINT with a
      Tarantool error, we need to change the way the mayAbort field
      works or delete it. Since this field is used only for make an
      assertion in debug mode, it is better to simply remove it.
      05b5f099
Loading