Skip to content
Snippets Groups Projects
  1. Dec 27, 2018
  2. Dec 25, 2018
    • Nikita Pettik's avatar
      Remove SQL string from index opts · 911139e3
      Nikita Pettik authored
      Closes #2647
      911139e3
    • Nikita Pettik's avatar
      sql: don't add string of 'CREATE INDEX ...' to index opts · 1babc99a
      Nikita Pettik authored
      Part of #2647
      1babc99a
    • Nikita Pettik's avatar
      sql: don't add string of 'CREATE TABLE...' to space opts · 111495cc
      Nikita Pettik authored
      We don't rely on this string anymore and it can be removed for ordinary
      tables. However, it is still used to hold SELECT body for view.
      
      Part of #2647
      111495cc
    • Nikita Pettik's avatar
      test: fix sqltester methods to drop all tables/views · 01c214eb
      Nikita Pettik authored
      Since we are going to remove string of SQL "CREATE TABLE ..." statement
      from space's opts, lets rework methods in sqltester to drop all tables
      and views in order to avoid relying on this parameter.
      
      Part of #2647
      01c214eb
    • Nikita Pettik's avatar
      sql: don't update SQL string during renaming · ce19dcbc
      Nikita Pettik authored
      Since SQL string containing "CREATE TABLE ..." statement is not used
      anymore for ordinary tables/space, it makes no sense to modify it during
      renaming. Hence, now rename routine needs only to update name in _space,
      so it can be done using simple update operation.
      
      Moreover, now we are able to rename spaces created from Lua-land.
      
      Part of #2647
      ce19dcbc
    • Nikita Pettik's avatar
      sql: avoid calling sql_encode_table_opts() during trigger creation · 3fcf32d6
      Nikita Pettik authored
      At the last stage of trigger creation, trigger's create statement
      ("CREATE TRIGGER ...") is encoded to msgpack. Since only this string is
      only member of a map to be encoded, is makes no sense to call whole
      sql_encode_table_opts() function, which in turn processes table's
      checks, opts for VIEW etc.
      
      Needed for #2647
      3fcf32d6
    • Nikita Pettik's avatar
      sql: decrease max depth of expression AST · 0b57f06f
      Nikita Pettik authored
      Currently, all routines connected with expression AST processing rely on
      recursive approaches. On the other hand, SQL is executed in a standard
      fiber, which features only 64kb of stack memory. Hence, deep recursion
      can result in stack overflow. To avoid obvious overflows lets
      significantly restrict allowed depth of expression AST. Note that it is
      not radical solution to this problem but rather temporary fix.
      
      Workaround for #3861
      0b57f06f
    • Nikita Pettik's avatar
      sql: disallow to rename space if it is referenced by view · cc2c920b
      Nikita Pettik authored
      Before this patch it was allowed to rename space which is referenced by
      a view. In turn, view contains SELECT statement in a raw form (i.e. as a
      string) and it is not modified during renaming routine. Hence, after
      renaming space still has referencing counter > 0, but no usage of view
      is allowed (since execution of SELECT results in "Space does not
      exist"). To avoid such situations, lets ban renaming space if its view
      reference counter > 0.
      
      Note that RENAME is ANSI extension, so different DBs behave in this case
      in different ways - some of them allow to rename tables referenced by a
      view (PostgreSQL), others - don't (Oracle).
      
      Closes #3746
      cc2c920b
    • Kirill Shcherbatov's avatar
      sql: Fix DEFAULTs AST memory leak on alter · 7c6c572c
      Kirill Shcherbatov authored
      The space_def_destroy_fields routine is used in make_scoped_guard
      on alter:space_def_new_from_tuple always pass extern_alloc=true
      for sql_expr_delete routine. It shouldn't as the first-time
      allocated AST object (field_def_decode) is not external-allocated.
      Introduced a new flag 'extern_alloc' for space_def_destroy_fields
      routine.
      
      Also fixed def_guard declaration in space_def_new_from_tuple:
      it should be right after space_def_new_xc call, otherwise
      subsequent tnt_raise/diag_raise call wouldn't fire it.
      
      Closes #3908
      7c6c572c
    • Kirill Shcherbatov's avatar
      box: pass string to ER_FIELD_TYPE, ER_ACTION_MISMATCH · 64344873
      Kirill Shcherbatov authored
      Reworked ER_FIELD_TYPE and ER_ACTION_MISMATCH error to pass path
      string to field instead of field number.
      This patch is required for further JSON patches, to give detailed
      information about field on error.
      
      Needed for #1012
      64344873
  3. Dec 24, 2018
    • Vladimir Davydov's avatar
      Move field_mp_type_is_compatible to field_def.h · 3ccbba33
      Vladimir Davydov authored
      This function and the associated table don't depend on key definition,
      only on field type. So let's move it from key_def.h to field_def.h.
      3ccbba33
    • Kirill Shcherbatov's avatar
      box: refactor field type and nullability checks · 454964df
      Kirill Shcherbatov authored
       - Reworked field types and nullability checks to set error message in
         tuple_init_field_map manually. We will specify full JSON path to the
         field further patches.
       - Introduced field_mp_type_is_compatible routine making field_type and
         mp_type compatibility test taking into account field nullability.
       - Refactored key_part_validate to pass const char *key argument and to
         reuse field_mp_type_is_compatible code.
      
      Needed for #1012
      454964df
    • Kirill Shcherbatov's avatar
      box: implement tuple_validate_raw using tuple_init_field_map · 8d1b54b0
      Kirill Shcherbatov authored
      Since the tuple_validate_raw and tuple_init_field_map functions
      make the same data checks, we implemented tuple_validate_raw via
      tuple_init_field_map called with region memory chunk is passed
      as field map. This is required because in subsequent patches
      the tuple_init_field_map routine logic will be complicated,
      and we want to avoid writing the same checks twice.
      
      Needed for #1012
      8d1b54b0
    • Vladimir Davydov's avatar
      vinyl: fix index build not working after recovery · 6351d916
      Vladimir Davydov authored
      While building a secondary index for a Vinyl space, we use xm->lsn to
      skip statements inserted after build began (as those statements are
      propagated by the on_replace trigger callback anyway). The xm->lsn is
      advanced every time we insert something into a Vinyl space. The problem
      is during recovery we skip statements that have been dumped to disk so
      xm->lsn may lag behind the instance vclock once recovery is complete.
      In this case if we try to create a new Vinyl index right after recovery
      completion, before any DML operation is executed on a Vinyl space, we
      will skip statements that would otherwise get into the new index.
      
      Fix this issue by resetting xm->lsn to the instance vclock upon recovery
      completion.
      
      Closes #3903
      6351d916
    • Alexander Turenko's avatar
      Forbid -DENABLE_ASAN=ON with GCC explicitly · d79a1bce
      Alexander Turenko authored
      The build time error is confusing for users. The patch makes the error
      explicit and moves it to the cmake stage.
      
      Follow up of #3070.
      d79a1bce
    • Vladislav Shpilevoy's avatar
      session: outdate a session of a closed connection · 43af2de2
      Vladislav Shpilevoy authored
      Once a connection is closed, a long-running user
      request can not learn about this occasion. Even
      box.sesion.push() still works.
      
      This patch makes such disconnected session 'rotten'.
      So a user can determine if a connection is closed by
      looking at session.fd() == -1, or checking for
      errors from box.session.push().
      
      Closes #3859
      43af2de2
    • Vladislav Shpilevoy's avatar
      session: store vtab both in struct and registry · 69d36781
      Vladislav Shpilevoy authored
      Before the patch vtabs were stored in a global array
      only, called registry and accessed by session.type to
      call a virtual method. But it does not allow to change
      session vtab without affecting session type. This
      feature is necessary to be able to outdate binary
      sessions whose socket is closed.
      
      Outdated, closed, sessions will return errors from all
      its methods.
      
      Needed for #3859
      69d36781
  4. Dec 22, 2018
    • Vladimir Davydov's avatar
      Revert "lua: fix tuple cdata collecting" · 2c351664
      Vladimir Davydov authored
      This reverts commit 022a3c50.
      
      According to FFI documentation [1], ffi.cast() creates a new object for
      the given type and initializes it with the given value. So setting a
      finalizer for a tuple before casting it to const_tuple_ref_t is totally
      wrong as it allows the Lua interpreter to invoke the finalizer as soon
      as the cast is complete. That said, we must revert the commit that
      swapped ffi.cast and ffi.gc order in tuple_bless() and reopen the issue
      it intended to fix - see #3751 - no wonder it improved the garbage
      collector performance as it basically made all tuples collectable right
      from the moment they are blessed.
      
      To make sure we won't step on the same issue again in future, let's also
      add a relevant test case.
      
      [1] http://luajit.org/ext_ffi_api.html
      
      Closes #3902
      2c351664
  5. Dec 21, 2018
  6. Dec 20, 2018
  7. Dec 19, 2018
  8. Dec 18, 2018
    • gdrbyKo1's avatar
    • gdrbyKo1's avatar
      Update external links in README.md · 7cb738dd
      gdrbyKo1 authored
      7cb738dd
    • Konstantin Nazarov's avatar
      Add .editorconfig to properly detect indentation in editors · df92238c
      Konstantin Nazarov authored
      Editorconfig is a standard of defining indentation style and other
      settings such as newline types for different file types in a project.
      
      See https://editorconfig.org/
      
      It is achieved by introducing a simple .editorconfig dotfile with
      glob expressions and settings per fiile type. Editors then can read
      this file and decide which indentation style they should use for a
      given project file.
      df92238c
    • Vladislav Shpilevoy's avatar
      sql: move sql_request and xrow_decode_sql to xrow lib · 16744224
      Vladislav Shpilevoy authored
      All binary struct *_request are stored in xrow.h/.c
      together with their decoders. The only reason why
      xrow_decode_sql was implemented in execute.c was a
      dependency on struct sql_bind. Now xrow_decode_sql
      and struct sql_request operate only by MessagePack and
      some iproto constants and are moved to their true
      home.
      
      Follow up #3828
      16744224
    • Vladislav Shpilevoy's avatar
      sql: decode bind parameters in TX thread · 55f22ec2
      Vladislav Shpilevoy authored
      Before this patch bind parameters were decoded in
      iproto thread in an attempt to save some TX thread
      time. But they were stored in an array allocated on
      iproto thread memory. Lack of iproto_msg destructor
      lead to leak of this array.
      
      This patch makes sql_request store only raw undecoded
      MessagePack and moves decoding to TX thread where in
      a single function the parameters are decoded, applied
      and freed.
      
      There were a couple of alternatives allowing to keep
      decoding in iproto thread and to move even more
      decoding there, for example, parameters from
      IPROTO_UPDATE:
      
      * decode on malloc and add a virtual destructor to
        struct iproto_msg;
      
      * decode on malloc and add a virtual destructor to
        struct cmsg. By the way, it could allow to reuse
        this destructor for struct cbus_call_msg and
        struct relay_gc_msg.
      
      The way how is it solved by this patch has been chosen
      thanks to its simplicity.
      
      Closes #3828
      55f22ec2
    • Vladislav Shpilevoy's avatar
      Revert "box: store sql text and length in sql_request" · 388452ae
      Vladislav Shpilevoy authored
      This reverts commit bc9e41e9.
      
      This is one step forward to make sql_request store raw
      MessagePack.
      
      Part of #3828
      388452ae
    • Vladislav Shpilevoy's avatar
      sql: remove sync from sql_request/response · a33f778e
      Vladislav Shpilevoy authored
      sql_request is now decoded entirely in iproto thread
      in iproto_msg_decode unlike other similar requests
      like CALL or UPDATE which could be decoded in iproto
      too.
      
      But iproto thread pays for this optimization with a
      leak - sql_request.bind array is allocated on iproto
      thread region and never freed.
      
      A fix is to decode, apply and free bind array in tx
      thread in one place: tx_process_sql. For this
      sql_request should look like other requests: do not
      decode arrays, do not store sync, store fields as
      raw MsgPack.
      
      First step - remove sync.
      
      Part of #3828
      a33f778e
Loading