Skip to content
Snippets Groups Projects
  1. Mar 13, 2018
  2. Mar 11, 2018
  3. Mar 07, 2018
    • Vladimir Davydov's avatar
      vinyl: don't track tuples that are already tracked in secondary index · d3d6899a
      Vladimir Davydov authored
      When scanning a secondary index, we actually track each tuple in the
      transaction manager twice - as a part of the interval read from the
      secondary index and as a point in the primary index when retrieving
      the full tuple. This bloats the read set - instead of storing just one
      interval for a range request, we also store each tuple returned by it,
      which may count to thousands. There's no point in this extra tracking,
      because whenever we change a tuple in the primary index, we also update
      it in all secondary indexes. So let's remove it to save us some memory
      and cpu cycles.
      
      This is an alternative fix for #2534
      It should also mitigate #3197
      d3d6899a
    • Vladimir Davydov's avatar
      vinyl: use point lookup explicitly where appropriate · 558d27b2
      Vladimir Davydov authored
      We never use vy_point_lookup directly, instead we open vy_read_iterator,
      which automatically falls back on vy_point_lookup if looking for exact
      match (EQ + full key). Due to this we can't add a new point lookup
      specific argument (we would have to propagate it through the read
      iterator, which is ugly). Let's call vy_point_lookup directly when we
      know that vy_read_iterator will fall back on it anyway.
      558d27b2
    • Vladimir Davydov's avatar
      Revert "vinyl: force read view in iterator in autocommit mode" · ca15907e
      Vladimir Davydov authored
      This reverts commit a31c2c10.
      
      The commit reverted by this patch forces all autocommit SELECTs to open
      a read view immediately, as a result they can't update tuple cache.
      Turned out that one of our customers intensively uses such SELECTs, and
      disabling cache for them results in performance degradation.
      
      The reason why that commit was introduced in the first place was to
      avoid read set bloating for big SELECTs (e.g. space.count()): currently
      we track not only read interval boundaries, but also each tuple fetched
      from the primary index if it is a secondary index that is being scanned.
      However, it doesn't seem that we really need to do that - tracking an
      interval read from a secondary index guarantees that if a tuple returned
      by the iterator is modified the transaction will be aborted and so
      there's no need to track individual tuples read from the primary index.
      
      That said, let's revert this commit and instead remove point lookup
      tracking in case it is a secondary index that is being scanned (done
      later in the series).
      ca15907e
    • Vladislav Shpilevoy's avatar
      vinyl: use vinyl iterators virtuality to remove 'if' in next() · 86d75ecf
      Vladislav Shpilevoy authored
      The first reason of the patch is that vinyl iterators are virtual
      already, and 'if's about constant index attributes (like index->id)
      can be replaced by new next() implementation. Now in next() index->id
      is checked to detect necessity of primary index lookup.
      
      Lets split next() in 2 functions: primary_next() and secondary_next()
      to remove 'if'.
      
      The second reason, that in #2129 logic of secondary index lookup
      complicates a lot. For example, there is raw idea to do not add
      statements into a cache before looking up in a primary index, because
      after #2129 any tuple, read from a secondary index, can be dirty.
      
      Needed for #2129
      86d75ecf
    • Konstantin Osipov's avatar
  4. Mar 06, 2018
    • Georgy Kirichenko's avatar
      Fix flaky test · db3cd7cd
      Georgy Kirichenko authored
      In most cases a tarantool yields on test_run connection and current
      transactions rollback, but some times a tarantool console already has more
      input to execute and select returns different results.
      
      Fixed #3145
      db3cd7cd
    • Vladimir Davydov's avatar
      vinyl: don't handle empty runs in vy_run_iterator_seek · 3a646ef6
      Vladimir Davydov authored
      We don't write empty run files anymore. Remove the dead code.
      3a646ef6
    • Vladimir Davydov's avatar
      vinyl: eliminate current stmt reallocations in run iterator · f632642a
      Vladimir Davydov authored
      Run iterator uses curr_pos (i.e. page number plus offset) as pointer to
      the current position. Whenever it needs to get a statement at curr_pos,
      it calls vy_run_iterator_read(), which allocates a new statement. It
      doesn't try to cache the last allocated statement, which results in
      multiple pointless reallocations of the same statement. For instance,
      vy_run_iterator_next_key() rereads the current statement, then moves to
      the next key, then calls vy_run_iterator_find_lsn(), which rereads the
      current statement again. This is just stupid.
      
      To avoid that, let's keep vy_run_iterator->curr_stmt in sync with
      curr_pos. This simplifies the code quite a bit and makes it more
      efficient.
      f632642a
    • Vladimir Davydov's avatar
      vinyl: zap vy_run_iterator->curr_stmt_pos · 392e4b25
      Vladimir Davydov authored
      vy_run_iterator_get() remembers the position of the last statement
      returned by the iterator in curr_stmt_pos. It then uses it to skip
      a disk read in case it is called again for the same iterator position.
      The code is left from the time when iterators had public virtual
      method 'get', which could be called several times without advancing
      the iterator. Nowadays, vy_run_iterator_get() is never called twice
      for the same iterator position (check coverity scan) so we can zap
      this logic.
      392e4b25
    • Vladimir Davydov's avatar
      vinyl: get rid of obscure page cache promotion logic · cc3e66a9
      Vladimir Davydov authored
      vy_run_iterator_load_page() keeps two most recently read pages. This
      makes sense, because we often probe a page for a better match. Keeping
      two pages rather than just one makes sure we won't throw out the current
      page if probing fails to find a better match. What doesn't make sense
      though is cache promotion logic: we keep promoting the page containing
      the current key. The comment says:
      
              /*
               * The cache is at least two pages. Ensure that
               * subsequent read keeps the cur_key in the cache
               * by moving its page to the start of LRU list.
               */
              vy_run_iterator_cache_touch(itr, cur_key_page_no);
      
      The comment is quite misleading. The "cache" contains at most two pages.
      Proudly calling this travesty of a cache LRU is downright ridiculous.
      
      Anyway, touching the current page will simply swap the two cached pages
      if a key history spans less than two pages, resulting in no performance
      gain or loss whatsoever. However, if a key history spans more than two
      pages, it will evict a page that is about to be read.
      
      That said, let's get rid of this piece of crap.
      cc3e66a9
    • Vladimir Davydov's avatar
      vinyl: simplify vy_run_iterator_next_key · 3dd29307
      Vladimir Davydov authored
      vy_run_iterator_next_key() has to special-case LE/LT for the first
      and the last page. This is needed, because this function is used by
      vy_read_iterator_seek() for starting iteration. Actually, there's no
      point for vy_read_iterator_seek() to use vy_read_iterator_next_key() -
      vy_read_iterator_next_pos() + vy_read_iterator_find_lsn() would be
      enough. Bearing this in mind, simplify vy_run_iterator_next_key().
      3dd29307
    • Konstantin Osipov's avatar
  5. Mar 05, 2018
  6. Mar 01, 2018
Loading