Skip to content
Snippets Groups Projects
  1. Apr 05, 2018
    • Nikita Pettik's avatar
      sql: remove obsolete pragmas · 86aaf3e8
      Nikita Pettik authored
      Some pragmas turn out to be useless and can't be applied to Tarantool's SQL.
      Moreover, couple of them lead to assertion faults.
      List or removed pragmas:
      - synchronous
      - empty_result_callbacks
      - WAL_autocheckpoint
      - WAL_checkpoint
      - secure_delete
      - database_list
      - data_version
      - compile_options
      - application_id
      - user_version
      - pragmas connected with HAS_CODEC macro
      - pragmas connected with heap memory managment
      86aaf3e8
    • vanyail's avatar
      sql: ban of REINDEX syntax · 73445865
      vanyail authored
      This change removes REINDEX from keywords and also disables tests
      which were using this syntax.
      
      This patch affects only parser, REINDEX implementation still exists,
      because it is planned to be fixed and enabled in the scope of #3195.
      
      Note that REINDEX keyword is still in '%fallback' directive in
      'parse.y'. Reserved keywords included there to avoid situation when
      a keyword has no usages within 'parse.y' file.
      
      Fixes #2174
      73445865
    • Bulat Niatshin's avatar
      sql: fix non-working 'INDEXED BY' clause · e4537700
      Bulat Niatshin authored
      Fix non-working 'INDEXED BY' clause for SELECT statement,
      which caused syntax-error during execution.
      
      Closes #2996
      e4537700
    • Vladislav Shpilevoy's avatar
      sql: remove useless branching in insertOrReplace · cc5e57d9
      Vladislav Shpilevoy authored
      Type of an operation for struct request can be passed directly
      with no "proxying" by special codes.
      cc5e57d9
    • Vladislav Shpilevoy's avatar
      sql: simplify lua SQL executor · 04ab1b01
      Vladislav Shpilevoy authored
      1) Code is completely unreadable and complicated by strange
         optimizations;
      2) It still supposes, that there can be multiple statements in a
         single string;
      3) It pushes first letter of affinity together with column names
         - why? It is not used anywhere.
      
      Lets remove prepared statements list, affinity first letters
      pushing.
      04ab1b01
    • Vladislav Shpilevoy's avatar
      sql: light error codes refactoring · 4dcffa84
      Vladislav Shpilevoy authored
      Remove unused error codes, use enum instead of
      defines. Later the prefix SQLITE_ must be removed -
      see #3315.
      4dcffa84
    • Vladislav Shpilevoy's avatar
      sql: remove unused operands from OP_IdxInsert/Replace · 5668add4
      Vladislav Shpilevoy authored
      And rework sqlite3CompleteInsertion. Before the patch it
      * accepts actually unused pTab;
      * array of records to insert in different indexes, but inserts
        only one;
      * has sqlite code style.
      
      Code style fix is obvious. PTab is used only to check, that it is
      not a view and to check, that a first index is primary:
      1) caller functions already guarantee the pTab is not a view;
      2) regardless of a first index nature: primary or not - it is not
         used here. It is useless check. With the same success we can
         check this in each function, that uses struct Table.
      
      Array of records to insert makes no sense, since insertion is
      being done in a primary index only. It is enough to pass a
      register with a primary index tuple.
      5668add4
  2. Apr 04, 2018
  3. Apr 03, 2018
    • Konstantin Osipov's avatar
    • Vladimir Davydov's avatar
      vinyl: fail transaction immediately if it does not fit in memory · 8f63d5d9
      Vladimir Davydov authored
      If the size of a transaction is greater than the configured memory
      limit (box.cfg.vinyl_memory), the transaction will hang on commit
      for 60 seconds (box.cfg.vinyl_timeout) and then fail with the
      following error message:
      
        Timed out waiting for Vinyl memory quota
      
      This is confusing. Let's fail such transactions immediately with
      OutOfMemory error.
      
      Closes #3291
      8f63d5d9
    • Kirill Yukhin's avatar
      sql: move default col values to Tarantool's core · b9c9792d
      Kirill Yukhin authored
      Extract expressions parsing into separate routine to
      allow Tarantool's backend compile DEFAULT statements w/o
      SQL machinery at all. So far, for DEFAULT values no context
      is needed: only constant expressions and built-ins are allowed.
      In future, table context will be added to allow use column
      values for CHECK constraint expressions.
      
      Move DEFAULT string value to space_def. Move compiled expresion
      to field_def as well. Reason not to move compiled expression
      to tuple_field as follows: we do not want to engage parser
      during tuple validation. So, do it in alter.cc.
      
      In order to allow expression duplication in alter.cc: expose
      those routines from expr.c and make their names correspond to
      coding style.
      
      Since recovery is performed before SQL fronend initialization:
      split it into two pieces: 1. create SQL handler, enable
      all subsystems 2. Do recovery.  This will allow to run
      parser during recovery, since it needs db handle so far.
      
      Part of #3235
      b9c9792d
  4. Apr 02, 2018
  5. Mar 31, 2018
    • Kirill Yukhin's avatar
      sql: remove dead find DB functions · 11404909
      Kirill Yukhin authored
      Remove functions to find DB by name. Not used anymore,
      was used by SQL legacy code.
      11404909
    • Kirill Yukhin's avatar
      Add value field to _schema space · ddd8a259
      Kirill Yukhin authored
      _schema represented as key-value storage for various
      values common for Tarantool, like next id for space creation.
      SQL requires format to be fully specified for columns being
      access. Unfortunatelly, _schema is inserted into _space
      before _space's format is set and since DD triggers are
      disabled during upgrade, format for _schema tuple in _space
      stays the same. So, set value nullable field in upgrade,
      regenerate initial snap, update tests.
      Also, as far as _schema's tuple in _space is not updated:
      relax fieldno check in sql.c
      ddd8a259
  6. Mar 30, 2018
    • Vladislav Shpilevoy's avatar
      1056c4e4
    • Konstantin Belyavskiy's avatar
      replication: recover missing local data from replica · eae84efb
      Konstantin Belyavskiy authored
      In case of sudden power-loss, if data was not written to WAL but
      already sent to remote replica, local can't recover properly and
      we have different datasets. Fix it by using remote replica's data
      and LSN comparison.
      
      Based on @GeorgyKirichenko proposal and @locker race free check.
      
      Closes #3210
      eae84efb
    • Konstantin Belyavskiy's avatar
      replication: stay in orphan mode until replica is synced by vclock · 7ebc8ae4
      Konstantin Belyavskiy authored
      Stay in orphan (read-only) mode until local vclock is lower than
      master's to make sure that datasets are the same across replicaset.
      Update replication/catch test to reflect the change.
      
      Suggested by @kostja
      
      Needed for #3210
      7ebc8ae4
    • Vladislav Shpilevoy's avatar
      iproto: rename IPROTO_SQL_OPTIONS to IPROTO_OPTIONS · 680b47a4
      Vladislav Shpilevoy authored
      IPROTO_OPTIONS can be used in the future for request types,
      different from IPROTO_EXECUTE.
      680b47a4
    • Vladislav Shpilevoy's avatar
      iproto: move IPROTO_SQL_ROW_COUNT to enum sql_info_key · 785ee69d
      Vladislav Shpilevoy authored
      IPROTO_SQL_ROW_COUNT is not a top level key in an iproto response
      and can be moved into a separate enum.
      785ee69d
    • Vladislav Shpilevoy's avatar
      Merge branch '1.10' into 2.0 · 60ae41da
      Vladislav Shpilevoy authored
      60ae41da
    • Vladimir Davydov's avatar
      Update LuaRocks · 3171288c
      Vladimir Davydov authored
      Closes #3148
      3171288c
    • Vladislav Shpilevoy's avatar
      console: do not try to prevent SIGPIPE in text console · 427795fa
      Vladislav Shpilevoy authored
      Text console tried to learn about SIGPIPE before its raising
      by read-before-write. If a socket is readable, but read returns
      0, then it is closed, and writing to it can raise SIGPIPE. But
      Tarantool ignores SIGPIPE, so the process will not be terminated,
      write() just returns -1.
      
      The original code checks for SIGPIPE, because when Tarantool is
      run under debugger (gdb or lldb), the debugger by default sets
      its own signal handlers, and SIGPIPE terminates the process.
      
      But debugger settings can be changed to ignore SIGPIPE too, so
      lets remove this overengineering from the console code.
      427795fa
    • Vladislav Shpilevoy's avatar
      netbox: fix a bug with ignored reconnect_after · f278d3f0
      Vladislav Shpilevoy authored
      If a remote host is unreachable on the first connection attempt,
      and reconnect_after is set, then netbox state machine enters
      error state, but it must enter error_reconnect. Do it.
      
      The bug was introduced by me in
      d2468dac.
      f278d3f0
    • Vladimir Davydov's avatar
      libev: use clock_gettime on OS X if available · 10af1cb1
      Vladimir Davydov authored
      EV_USE_REALTIME and EV_USE_MONOTONIC, which force libev to use
      clock_gettime, are enabled automatically on Linux, but not on OS X. We
      used to forcefully enable them for performance reasons, but this broke
      compilation on certain OS X versions and so was disabled by commit
      d36ba279 ("Fix gh-1777: clock_gettime detected but unavailable in
      macos"). Today we need these features enabled not just because of
      performance, but also to avoid crashes when time changes on the host -
      see issue #2527 and commit a6c87bf9 ("Use ev_monotonic_now/time
      instead of ev_now/time for timeouts"). Fortunately, we have this cmake
      defined macro HAVE_CLOCKGETTIME_DECL, which is set if clock_gettime is
      available. Let's enable EV_USE_REALTIME and EV_USE_MONOTONIC if this
      macro is defined.
      
      Closes #3299
      10af1cb1
  7. Mar 29, 2018
    • Vladislav Shpilevoy's avatar
      Merge branch '1.10' into 2.0 · 3780f5ab
      Vladislav Shpilevoy authored
      3780f5ab
    • Vladislav Shpilevoy's avatar
      Fix net.box test · 405446e0
      Vladislav Shpilevoy authored
      405446e0
    • Vladimir Davydov's avatar
      vinyl: fix discrepancy between vy_log.tx_size and actual tx len · 94569f65
      Vladimir Davydov authored
      When a vylog transaction is rolled back, we always reset vy_log.tx_size.
      Generally speaking, this is incorrect as rollback doesn't necessarily
      remove all pending records from the tx buffer - there still may be
      records committed with vy_log_tx_try_commit() that were left in the
      buffer due to write errors.  We don't rollback such records, but we
      still reset tx_size, which leads to a discrepancy between vy_log.tx_size
      and the actual length of vy_log.tx list, which further on results in an
      assertion failure:
      
        src/box/vy_log.c:698: vy_log_flush: Assertion `i < vy_log.tx_size' failed.
      
      We need vy_log.tx_size to allocate xrow_header array of a proper size so
      that we can flush pending vylog records to disk. This isn't a hot path
      there, because vylog operations are rare. Besides, we iterate over all
      records anyway to fill the xrow_header array. That said, let's remove
      vy_log.tx_size altogether and instead calculate the vy_log.tx list
      length right in place.
      94569f65
    • Vladimir Davydov's avatar
      vinyl: use rlist for iterating over objects recovered from vylog · 197e1ef0
      Vladimir Davydov authored
      Currently, we use mh_foreach, but each object is on an rlist, which
      suits better for iteration.
      197e1ef0
    • Vladimir Davydov's avatar
      index: add abort_create virtual method · 7dee93a0
      Vladimir Davydov authored
      The new method is called if index creation failed, either due to WAL
      write error or build error. It will be used by Vinyl to purge prepared
      LSM tree from vylog.
      7dee93a0
    • Vladislav Shpilevoy's avatar
      Merge branch '1.10' into 2.0 · 4d5349e9
      Vladislav Shpilevoy authored
      4d5349e9
    • Vladislav Shpilevoy's avatar
      Fix net.box test · d9e254f8
      Vladislav Shpilevoy authored
      d9e254f8
    • IlyaMarkovMipt's avatar
      cfg: Add constraints on box.cfg params · 8b61be60
      IlyaMarkovMipt authored
      Introduce limitations on combinations of box.cfg parameters.
      * Add restriction on log type file and log_nonblock=true.
      * Add restriction on log type syslog and log_format json.
      * Each restriction creates error in case of its violation.
      * Change log_nonblock default value to nil, which means default values
      of log_nonblock corresponding to type of logger.
      * Add box_getb function for receiving bool parameters from cfg.
      
      Relates #3014 #3072
      8b61be60
    • Konstantin Osipov's avatar
      Merge branch '1.9' into 1.10 · 97cc085f
      Konstantin Osipov authored
      97cc085f
    • Ilya Markov's avatar
      log: Fix logging large objects · 5ab4581d
      Ilya Markov authored
      The bug was that logging we passed to function write
      number of bytes which may be more than size of buffer.
      This may happen because formatting log string we use vsnprintf which
      returns number of bytes would be written to buffer, not the actual
      number.
      
      Fix this with limiting number of bytes passing to write function.
      
      Close #3248
      5ab4581d
    • Konstantin Osipov's avatar
    • Konstantin Osipov's avatar
      Merge branch '1.9' into 1.10 · 180af15f
      Konstantin Osipov authored
      180af15f
    • Vladimir Davydov's avatar
      vinyl: improve latency stat · f3a84293
      Vladimir Davydov authored
      To facilitate performance analysis, let's report not only 99th
      percentile, but also 50th, 75th, 90th, and 95th. Also, let's add
      microsecond-granular buckets to the latency histogram.
      
      Closes #3207
      f3a84293
Loading