Skip to content
Snippets Groups Projects
  1. Mar 01, 2019
    • Vladimir Davydov's avatar
      test: check vinyl/json corner cases · 2f148001
      Vladimir Davydov authored
      Follow-up
      
        5993e149 vinyl: sanitize full/empty key stmt detection
        4273ec52 box: introduce JSON Indexes
      2f148001
    • Vladimir Davydov's avatar
      vinyl: sanitize full/empty key stmt detection · 5993e149
      Vladimir Davydov authored
      Historically, we use tuple_field_count to check whether a statement
      represents an empty key (match all) or a full key (point lookup): if
      the number of fields in a tuple is greater than or equal to the number
      of parts in a key definition, it can be used as a full key; if the
      number of fields is zero, then the statement represents an empty key.
      
      While this used to be correct not so long ago, appearance of JSON
      indexes changed the rules of the game: now a tuple can have nested
      indexed fields so that the same field number appears in the key
      definition multiple times. This means tuple_field_count can be less
      than the number of key parts and hence the full key check won't work
      for a statement representing a tuple.
      
      Actually, any tuple in vinyl can be used as a full key as it has all
      key parts by definition, there's no need to use tuple_field_count for
      such statements - we only need to do that for statements representing
      keys. Keeping that in mind, let's introduce helpers for checking
      whether a statement can be used as a full/empty key and use them
      throughout the code.
      5993e149
    • Alexander Turenko's avatar
      test: update test-run · 3191cd83
      Alexander Turenko authored
      Fix test_run:cmd('set variable ...') for string values (PR #146). It is
      needed for enabling the use_unix_sockets_iproto option.
      3191cd83
    • Vladislav Shpilevoy's avatar
      salad: fix mhash 'random' method · 1f34ec78
      Vladislav Shpilevoy authored
      Mhash 'random' method is supposed to return a valid node id given
      an arbitrary integer, likely generated randomly. But on some
      values it was returning 'end' marker despite emptiness of the
      container.
      
      This was because of confusion in usage of mh_size() and mh_end().
      Mh_size() means real number of objects, stored in the cache,
      while mh_end() means hash capacity, or 'number of buckets' as it
      is named. Generally capacity is bigger than size, and sometimes
      it led to a situation like this:
      
          size = 1
          capacity = 4
          rnd = 3
      
          [0]  [1]  [2]  [3]
           -    -    x    -
      
      When code iterates only 'size' times, looking for an element
      starting from 'rnd' position, it will not find anything. It
      should iterate 'capacity' times instead.
      1f34ec78
    • Vladislav Shpilevoy's avatar
      sio: make sio_strfaddr taking const struct sockaddr · 1a6e208e
      Vladislav Shpilevoy authored
      SWIM module API is going to provide a set of clear and pure
      functions with appropriately settled const qualifiers. And it
      wants to use sio_strfaddr() to provide to user an easy way to
      get a pointer to URI of a SWIM member stored in a const memory.
      
      It requires this two-line modification of sio module.
      1a6e208e
  2. Feb 28, 2019
    • Ilya Kosarev's avatar
      iproto: report active connections number · c96eca3c
      Ilya Kosarev authored
      Now there is new member in box.stat.net() called "CONNECTIONS"
      which is a number of active iproto connections.
      
      Closes #3905
      
      @TarantoolBot document
      Title: box.stat.net
      Update the documentation for box.stat.net
      to reflect the addition of the field
      which reports iproto connections number.
      c96eca3c
    • Vladimir Davydov's avatar
      test: fix app/socket sporadic failure · 216e0b14
      Vladimir Davydov authored
      The patch fixes the following test failure:
      
       | --- app/socket.result	Mon Feb 25 17:32:49 2019
       | +++ app/socket.reject	Mon Feb 25 17:39:51 2019
       | @@ -2827,7 +2827,7 @@
       |  ...
       |  echo_fiber ~= nil
       |  ---
       | -- true
       | +- false
       |  ...
       |  client:write('hello')
       |  ---
      
      This happens, because we don't wait for echo_fiber to start.
      Use a channel to make sure it does. Also, increase read/write
      timeouts from 0.1 up to 5 seconds - it won't increase the test
      runtime, but it will make it more robust.
      
      Closes #4022
      216e0b14
    • Vladimir Davydov's avatar
      test: fix box/iproto_stress sporadic failure · 48b0070b
      Vladimir Davydov authored
      This patch fixes the following test failure:
      
       | --- box/iproto_stress.result	Tue Dec 25 09:56:54 2018
       | +++ box/iproto_stress.reject	Tue Dec 25 10:12:22 2018
       | @@ -80,7 +80,7 @@
       |  ...
       |  n_workers -- 0
       |  ---
       | -- 0
       | +- 340
       |  ...
       |  n_errors -- 0
       |  ---
       | @@ -93,5 +93,3 @@
       |  ---
       |  ...
       |  box.cfg{net_msg_max = net_msg_max}
       | ----
       | -...
      
      The problem is the test is quite cpu intensive so if the host is heavily
      loaded (as it is often the case when tests are run on Travis CI), it may
      take a few minutes to complete, while the timeout is set to 10 seconds.
      
      To fix it, let's
       - Increase the timeout up to 60 seconds and use test_run.wait_cond
         instead of a homebrew loop.
       - Decrease the number of fibers from 400 down to 100 and adjust
         box.cfg.net_msg_max respectively.
      
      Closes #3911
      48b0070b
    • Konstantin Osipov's avatar
    • Vladimir Davydov's avatar
      vinyl: optimize mem iterator for frequently updated keys · 7383b295
      Vladimir Davydov authored
      If a key is frequently updated, iteration to the next key stored in the
      memory level can take quite a while, because:
      
       - In case of GE/GT iterator, vy_mem_iterator_next_key will have to
         iterate the tree from left to right to skip older key versions.
      
       - In case of LE/LT iterator, vy_mem_iterator_find_lsn will have to
         iterate the tree from right to left to find the newest key version
         visible in the read view.
      
      To avoid that, let's fall back on key lookup if we failed to find an
      appropriate statement after one iteration, because in this case there's
      a good chance that there's more statements for this key. This should be
      fine since a lookup in a memory tree is pretty cheap.
      7383b295
    • Vladimir Davydov's avatar
      vinyl: refactor vy_mem_iterator_seek · 5e8bb532
      Vladimir Davydov authored
       - Don't pass iterator_type to vy_mem_iterator_seek and functions called
         by it. Instead pass only a key and jump to the first statement
         following the key according to the iterator search criteria. Turns
         out this is enough for memory iterator implementation.
       - Fold EQ check in vy_mem_iterator_seek to avoid code duplication.
       - Drop vy_mem_iterator_start and use vy_mem_iterator_seek directly.
      5e8bb532
    • Vladimir Davydov's avatar
      test: fix box/push.test sporadic hang · 40251c60
      Vladimir Davydov authored
      This patch fixes the following test failure:
      
       | --- box/push.result	Thu Jan 24 13:10:04 2019
       | +++ var/001_box/push.result	Thu Jan 24 13:13:08 2019
       | @@ -536,17 +536,3 @@
       |  ---
       |  ...
       |  chan_disconnected:get()
       | ----
       | -- true
       | -...
       | -chan_push:put(true)
       | ----
       | -- true
       | -...
       | -chan_push:get()
       | ----
       | -- Session is closed
       | -...
       | -box.schema.func.drop('do_long_and_push')
       | ----
       | -...
      
      The problem occurs because the main fiber may close the connection
      before do_long_and_push sets the session.on_disconnect trigger, in
      which case chan_disconnected:get() will never return. Fix this by
      setting the trigger in the main fiber and adding another channel
      to wait for do_long_and_push function to start. Also, don't forget
      to clear the trigger once the test is complete.
      
      Fixes commit 43af2de2 ("session: outdate a session of a closed
      connection").
      
      Closes #3947
      40251c60
    • Kirill Shcherbatov's avatar
      box: rework tuple_init_field_map to allocate field_map · cde94067
      Kirill Shcherbatov authored
      Due to the fact that in the case of multikey indexes, the size of
      the field map may depend on a particular tuple, the
      tuple_int_field_map function has been reworked in such a way as
      to allocate the field map of the required size and return it.
      
      Needed for #1257
      cde94067
  3. Feb 27, 2019
    • Alexander Turenko's avatar
      test: update test-run · c346b342
      Alexander Turenko authored
      * Added basic luacov support.
      * Added use_unix_sockets_iproto option.
      * Fixed TARANTOOL_SRC_DIR on >=tarantool-2.1.1-322-g3f5f59bb5.
        - It is important for app-tap/http_client.test.lua, it fails now.
      * Renamed pre_cleanup to pretest_clean.
      * pretest_clean: clean up _cluster space.
      c346b342
    • Alexander Turenko's avatar
      uri: fix uri.c generation command (make ragel) · 4ac85422
      Alexander Turenko authored
      The bug was introduced in d735b6bf (move
      'uri' lib to src/lib/).
      4ac85422
    • Alexander Turenko's avatar
      uri: fix uri.c debug info for lcov · 415c0586
      Alexander Turenko authored
      lcov reports the following warnings:
      
      Cannot open source file src/uri.rl
      Cannot open source file src/uri.c
      
      coveralls-lcov then fails with this message:
      
      coveralls-lcov --service-name travis-ci --service-job-id 498721113 --repo-token [FILTERED] coverage.info
      /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:63:in `initialize': No such file or directory @ rb_sysopen - /tarantool/src/lib/uri/CMakeFiles/uri.dir/src/uri.c (Errno::ENOENT)
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:63:in `open'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:63:in `generate_source_file'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:16:in `block in convert'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:15:in `each'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/converter.rb:15:in `convert'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/lib/coveralls/lcov/runner.rb:68:in `run'
      	from /var/lib/gems/2.3.0/gems/coveralls-lcov-1.5.1/bin/coveralls-lcov:5:in `<top (required)>'
      	from /usr/local/bin/coveralls-lcov:22:in `load'
      	from /usr/local/bin/coveralls-lcov:22:in `<main>'
      
      So coverage target in Travis-CI fails and a coverage does not reported
      to coveralls.io.
      
      The bug was introduced in d735b6bf (move
      'uri' lib to src/lib/).
      415c0586
    • Vladislav Shpilevoy's avatar
      Move 'info' library to src/lib · effe10e5
      Vladislav Shpilevoy authored
      'Info' is a header-only library consisting of one file. It is
      going to be used by SWIM, stored in src/lib, but src/lib can not
      depend on src/. This commit moves 'info' to lib/info.
      
      Needed for #3234
      effe10e5
    • Vladislav Shpilevoy's avatar
      Extract 'coll' library from 'core' · 8222f988
      Vladislav Shpilevoy authored
      Core is supposed to be the most basic library, providing only
      really common features used everywhere like fiber, diag, memory,
      logging. Which can't be said about collations - they are used
      only by high level things - SQL, Lua utf8, comparators.
      
      Collations are built now as 'lib/coll' library.
      
      The patch is not necessary for anything, but it is a right thing
      to do, while some activity is happening there.
      8222f988
    • Mergen Imeev's avatar
      sql: remove "syntax error after column name" error · be15f01f
      Mergen Imeev authored
      Error "syntax error after column name" does not make any sense.
      Let's remove it.
      
      Part of ...3965
      be15f01f
    • Mergen Imeev's avatar
      sql: remove SQLite mentions · 8bb355a1
      Mergen Imeev authored
      8bb355a1
    • Mergen Imeev's avatar
      sql: remove SQL_*_BKPT macros · d223eb4c
      Mergen Imeev authored
      Macros SQL_*_BKPT were used in debug mode to log errors that
      occurred during the execution of VDBE. They are not used now.
      This patch removes them.
      
      Part of #3965
      d223eb4c
    • Mergen Imeev's avatar
      sql: remove test gh-3733-pragma.test.lua · 828b8b36
      Mergen Imeev authored
      @TarantoolBot document
      Title: changes in EXPLAIN and PRAGMA
      
      The most important change is that the column names for
      the result of the "EXPLAIN ...", "EXPLAIN QUERY PLAN ..."
      and "PRAGMA ..." commands are now defined.
      Example:
      box.cfg{listen = 3302}
      cn = require('net.box').connect(box.cfg.listen)
      cn:execute('EXPLAIN SELECT 1;')
      
      In addition, the 'case_sensitive_like', 'parser_trace' and
      'sql_default_engine' pragmas now return their values if
      they are executed without arguments. For the first two
      pragmas, this value is their state, and for the latter,
      the default engine currently set in SQL.
      Example:
      box.sql.execute('PRAGMA case_sensitive_like;')
      
      And the last change is that now the execution of the
      “PRAGMA” command without determining which pragma to
      execute returns status for all flag-type pragmas.
      Flag-type pragmas are pragmas that have TRUE or FALSE as
      status.
      Example:
      box.sql.execute('PRAGMA;')
      828b8b36
    • Mergen Imeev's avatar
      sql: set column types for EXPLAIN and PRAGMA · 617dda85
      Mergen Imeev authored
      Currently, EXPLAIN and PRAGMA do not set the column types for the
      result. This is incorrect, since any returned row must have a
      column type. This patch defines the types for these columns.
      
      Closes #3832
      617dda85
    • Mergen Imeev's avatar
      sql: get results of PRAGMA statement as result set · 1328a88d
      Mergen Imeev authored
      Currently box.sql.execute ('PRAGMA') returns nothing, but prints
      list of pragmas and their statuses to stdout. Such strategy is
      considered to be wrong since output of this command would be
      unavailable for users who redirect stdout, use net box connection
      etc. This patch makes the command to return result as the rest of
      SQL commands. The result contains only FLAG-type pragmas and their
      statuses.
      1328a88d
    • Mergen Imeev's avatar
      sql: fix "PRAGMA case_sensitive_like" result · 3c97df13
      Mergen Imeev authored
      Currently PRAGMA case_sensitive_like returns nothing. This seems
      wrong, since other similar pragmas return their status. Fixed in
      the current patch.
      3c97df13
    • Mergen Imeev's avatar
      sql: Show currently set sql_default_engine · 87d2163e
      Mergen Imeev authored
      After this patch, "PRAGMA sql_default_engine" called without
      arguments will return currently set sql_default_engine.
      87d2163e
    • Mergen Imeev's avatar
      sql: fix "PRAGMA parser_trace" result · b67cf078
      Mergen Imeev authored
      Currently PRAGMA parser_trace returns an empty table. This seems
      wrong, since other similar pragmas return their status. Fixed in
      the current patch.
      b67cf078
    • Mergen Imeev's avatar
      sql: remove unused macros from pragma.c and pragma.h · 13a5889b
      Mergen Imeev authored
      Some macros in pragma.c and pragma.h are obsolete because the
      values they are checking are no longer used or their usage makes
      no sense. Let's remove them.
      13a5889b
  4. Feb 26, 2019
    • Vladislav Shpilevoy's avatar
      Move 'core' and 'uuid' libs to src/lib · 3f5f59bb
      Vladislav Shpilevoy authored
      For the same reason why 'uri' was moved to src/lib - SWIM needs
      core and uuid, and SWIM will live in src/lib.
      
      This commit follows 'uri' relocation as a separate one because
      'uri' relocation required some changes in the files, moved by
      this commit.
      
      Needed for #3234
      3f5f59bb
    • Vladislav Shpilevoy's avatar
      Move 'http_parser' to src/lib · 63db1372
      Vladislav Shpilevoy authored
      Http_parser in fact does not depend on anything, even on the core.
      As a rule, such basic libraries are stored in src/lib.
      
      The patch is not necessary for anything, but it is a right thing
      to do, while some activity is happening there.
      63db1372
    • Vladislav Shpilevoy's avatar
      Remove dead dependency of http_parser on httpc · 8f695fc4
      Vladislav Shpilevoy authored
      Http_parser is a standalone library, which in fact does not
      require httpc. And because of that it is going to be moved into
      lib/http_parser.
      8f695fc4
    • Vladislav Shpilevoy's avatar
      Move 'uri' lib to src/lib/ · d735b6bf
      Vladislav Shpilevoy authored
      URI and core libraries are going to be used by SWIM, stored in
      src/lib. But src/lib can not depend on src/. This patch pushes
      URI library down to src/lib - the lowest level of source
      dependencies.
      
      Needed for #3234
      d735b6bf
  5. Feb 25, 2019
    • Kirill Shcherbatov's avatar
      memtx: introduce universal iterator_pool · f21edaed
      Kirill Shcherbatov authored
      Memtx uses separate mempools for iterators of different types.
      Due to the fact that there will be more iterators of different
      sizes in a series of upcoming changes, let's always allocate the
      iterator of the largest size.
      No changes have been made to the rtree iterators pool because the
      size of these structures is significantly larger.
      
      Needed for #3961
      f21edaed
    • Vladimir Davydov's avatar
      iproto: don't attempt to close socket if it was not open · 37b88314
      Vladimir Davydov authored
      This can't entail any consequences, because socket fd is set to -1 in
      this case, but this just looks a bit messy. Let's clean it up.
      
      Follow-up commit 305dbcf6 ("iproto: close socket explicitly before
      wal_dir at exit").
      37b88314
    • Nikita Pettik's avatar
      sql: re-enable ORDER BY field filter optimization · a7bbd70b
      Nikita Pettik authored
      When we replaced SQLite's ephemeral spaces with our ones, one
      optimization concerning ORDER BY clause was disabled. It allows to
      reduce number of fields in format of ephemeral space or sorter table.
      To illustrate how it works, consider example:
      
      CREATE TABLE t (id INT PRIMARY KEY, b INT);
      SELECT * FROM t ORDER BY b;
      
      To sort entries from t, ephemeral space with format [b, id, b] is
      created. One can see, that such format contains duplicate of b column.
      To avoid such situation, SQLite provides optimization which removes
      duplicates. Meanwhile, it doesn't change already set format of ephemeral
      (or sorter) space (and SQLite tolerates that format difference). That's
      why it was turned off. However, such optimization turns out to be not
      optional but required: some column values shouldn't be computed twice.
      For instance:
      
      SELECT random() AS x FROM t ORDER BY x;
      
      Without filtering fields from ephemeral space format, it would be like:
      [random(), random()]. In other words, results would be sorted by first
      call to random() function, but resulting set would consist of values
      given by second call of random(). So, to enable it, we should reduce
      field count in format of ephemeral space by number of matches between
      SELECT and ORDER BY column lists.
      
      Also, type of return value for random() function has been fixed.
      
      Closes #3783
      a7bbd70b
    • Kirill Shcherbatov's avatar
      memtx: hide index implementation details from header · 5be640a6
      Kirill Shcherbatov authored
      Refactored memtx_tree code so that memtx_tree.h, memtx_rtree.h,
      memtx_bitset.h, memtx_hash.h contained only the signature of the
      tree object constructor while all implementation details were in
      corresponding *.c files.
      
      Needed for #3961
      5be640a6
    • Kirill Shcherbatov's avatar
      lib: introduce BPS_TREE_IDENTICAL custom comparator · bb83a922
      Kirill Shcherbatov authored
      Introduce a macro BPS_TREE_IDENTICAL for BPS TREE class. This
      makes possible to define custom comparators for stucture-based
      leafs.
      Previously, a C++ comparison operator "!=" override was used for
      this purpose. Due to the fact that we are not going to rework on
      C++ C-only components of Tarantool like memtx_tree, we needed a
      way to make complex structures comparisons using preprocessor.
      
      Needed for #3961
      bb83a922
    • Kirill Shcherbatov's avatar
      lib: fix undef _api_name in bps_tree header · 250423ca
      Kirill Shcherbatov authored
      The bps_tree.h header defines the macro _api_name, but does not
      undefine it at the end. Fixed.
      250423ca
    • Ilya Kosarev's avatar
      iproto: close socket explicitly before wal_dir at exit · 305dbcf6
      Ilya Kosarev authored
      tarantool instance didn't close socket explicitly
      which could cause hot standby instance to fail to bind
      in case it tries to bind before socket is closed by OS.
      Now it is fixed by closing socket explicitly before wal_dir.
      
      Closes #3967
      305dbcf6
    • Roman Khabibov's avatar
      httpc: add checking of headers in httpc:request · 85e1d78b
      Roman Khabibov authored
      Add preprocessing of the request headers. Each header must be 'string' or 'table'
      with '__tostring' metamethod.
      
      Closes #3679
      85e1d78b
Loading