Skip to content
Snippets Groups Projects
  1. Feb 22, 2019
    • Konstantin Osipov's avatar
      sql: rename struct fkey and struct fkey_def · d7d613a2
      Konstantin Osipov authored
      Rename struct fkey and struct fkey_def to fk_constraint and
      fk_constraint_def respectively.
      Consistently use "fk" for foreign key variables, and fk_def for
      foreign key definition variables.
      
      Remove dependency of fkey.h on space.h.
      Enfore subject-verb-object naming in a few fk-related methods.
      d7d613a2
    • Konstantin Osipov's avatar
      Follow up on the patch adding transaction boundaries to xrow stream. · c9fadff3
      Konstantin Osipov authored
      Follow up on the patch adding transaction boundaries to xrow stream.
      Use tsn as an abbreviation for transaction identifier (transaction
      sequence number). It is an important enough concept to use a short and
      a convenient tag name for.
      Deploy the name across the code - in names and comments.
      Clarify comments.
      Still use box_txn_id() as API method since box_tsn() and box_txn() would
      be too easy to mistype.
      c9fadff3
    • Nikita Pettik's avatar
      sql: fix grammar for foreign key actions · c2bddf70
      Nikita Pettik authored
      SQLite grammar implementing foreign keys parsing is quite compact, but
      on the other hand it allows to define ON DELETE and ON UPDATE actions
      multiple times. For instance:
      
      ... REFERENCES t ON DELETE UPDATE ON DELETE RESTRICT;
      
      It makes no sense and contradicts original ANSI syntax. So, lets rework
      it a bit. Firstly, MATCH clause must come first, so we place it in
      independent rule. Then we remove ON INSERT clause, since there is no
      such opportunity at all. Finally, we have only 4 options to expose
      refargs (i.e. grammar rule to parse FK actions): ON UPDATE, ON DELETE,
      ON UPDATE ON DELETE, ON DELETE ON UPDATE. That's it.
      
      Closes #3475
      c2bddf70
  2. Feb 21, 2019
    • Georgy Kirichenko's avatar
      Journal transaction boundaries · 872d6f1f
      Georgy Kirichenko authored
      Append txn_id and is_commit to xrow_header structure, txn_id identifies
      transaction id on replica where transaction was started. As transaction id
      a lsn of the first row in the transaction is used. is_commit is set to true
      for the last row in a transaction.
      
      As encoding/deconding rule assumed:
       * txn_id encoded using transaction sequence number iproto field
         as IPROTO_TSN = lsn - txn_id,
       * is_commit packed into IPROTO_FLAGS field with a bit mask,
       * txn_id and is_commit are encoded only for multi-row transactions.
         So if we do not have txn_id after row decoding then this means that it
         is a single row transaction.
      
      These rules provide compatibility with previous xlog format as well
      as good compaction level.
      
      Needed for #2798
      872d6f1f
    • Vladimir Davydov's avatar
      vinyl: move vy_tuple_key_contains_null to generic code · bd0d43f0
      Vladimir Davydov authored
      The function doesn't require any knowledge of vinyl statement layout and
      can work on regular tuples. Let's rename it to tuple_key_contains_null,
      move its implementation to tuple_extract_key.cc, and declare it in
      key_def.h, as we do with other similar functions.
      bd0d43f0
    • Vladimir Davydov's avatar
      key_def: move cmp and hash functions declarations to key_def.h · 6df0ffa4
      Vladimir Davydov authored
      Most of them are already there - for instance see see tuple_extract_key
      and tuple_compare. Let's move the rest there too for consistency.
      6df0ffa4
    • Vladimir Davydov's avatar
      key_def: cleanup virtual function initialization · e49ffe9c
      Vladimir Davydov authored
       - Rename key_def_set_cmp to key_def_set_func, because it sets not only
         comparators these days.
       - Rename tuple_hash_func_set and tuple_extract_key_set to
         key_def_set_hash_func and key_def_set_extract_func, because it's more
         like subject-verb-object naming convention used throughout the code.
       - Introduce key_def_set_compare_func and use it instead of setting
         comparators explicitly in key_def.c.
      e49ffe9c
    • Vladimir Davydov's avatar
      vinyl: make vy_tuple_delete static · 4e6781ec
      Vladimir Davydov authored
      It isn't used anywhere outside vy_stmt.c.
      4e6781ec
    • Vladimir Davydov's avatar
      vinyl: use vy_lsm_env::empty_key where appropriate · 19de37d5
      Vladimir Davydov authored
      No need to allocate an empty key during DDL - we already have one
      preallocated in vy_lsm_env.
      19de37d5
    • Michał Durak's avatar
      lua: add 'chars' param to string.strip functions · 16f58830
      Michał Durak authored
      Add optional 'chars' parameter to string.strip, string.lstrip
      and string.rstrip for specifying the unwanted characters.
      Behavior modeled after the equivalent Python built-ins.
      
      Closes: #2977
      
      @TarantoolBot document
      Title: string.strip(inp, chars)
      Update the documentation for string.strip,
      string.lstrip and string.rstrip to reflect
      the addition of the optional param.
      16f58830
    • Mergen Imeev's avatar
      sql: add space name in error message · 61f9017f
      Mergen Imeev authored
      This patch adds space name to descriptions of some of new errors.
      Also it fixes name and description of a few errors.
      
      Part of #3965
      61f9017f
    • Vladislav Shpilevoy's avatar
      netbox: raise an error on a closed connection async call · eed866fb
      Vladislav Shpilevoy authored
      When a connection is closed, it should not allow any
      requests - async and not. But before this patch this error
      from netbox.perform_async_request was ignored.
      eed866fb
  3. Feb 18, 2019
    • Vladislav Shpilevoy's avatar
      test: add missing unit/sio.result · d306250e
      Vladislav Shpilevoy authored
      d306250e
    • Mergen Imeev's avatar
      sql: rework "no such object" and "object exists" errors · 2319caeb
      Mergen Imeev authored
      This patch reworks SQL errors of types "no such object" and
      "object exists". After this patch, these error will be set as
      Tarantool errors.
      
      Part of #3965
      2319caeb
    • Mergen Imeev's avatar
      sql: remove field suppressErr from struct sql · 7126d89f
      Mergen Imeev authored
      The suppressErr field was used to indicate that most of the errors
      during the parsing should be suppressed. There was only one
      feature that used it. After deleting this feature, it became
      obvious that this field had become unused and should be removed.
      
      The feature in question is: allow to use names and aliases from
      input in ORDER BY clause of UNION or INTERSECT. After deleting
      of this feature, requests like the one below become invalid:
      
      SELECT 1 AS a UNION ALL SELECT 2 AS b ORDER BY b;
      
      Part of #3965
      7126d89f
    • Stanislav Zudin's avatar
      sql: remove useless pragmas · 5a58d78a
      Stanislav Zudin authored
      The pragmas "query_only" and "read_uncommitted" didn't affect anything
      and were removed.
      Fixed an error in pragma index_list which caused a segmantation fault.
      pragma sql_default_engine accepts only strings.
      Thus pragma sql_default_engine('memtx') is a well-formed command,
      while pragma sql_default_engine(memtx) or
      pragma sql_default_engine("memtx") are considered as an ill-formed and
      raise an error.
      
      Closes #3733
      5a58d78a
    • Kirill Shcherbatov's avatar
      box: disable sparse optimization in box.tuple.new() · 1a4d8874
      Kirill Shcherbatov authored
      The box.tuple.new() used to call luamp_encode_tuple with
      default LUA serializer config 'luaL_msgpack_default'. This
      routine may consider an array to be excessively sparse when
        + encode_sparse_ratio > 0
        + max(table) > encode_sparse_safe
        + max(table) > count(table) * encode_sparse_ratio.
      Sparse optimization save memory via representing excessively
      sparse tuple as MP_MAP. But Tarantool tuple always must be
      MP_ARRAY so it is not relevant for box.tuple.new semantics.
      So it is disabled with encode_sparse_ratio = 0 in a new local
      serializer config.
      
      Closes #3882
      1a4d8874
  4. Feb 15, 2019
    • Vladislav Shpilevoy's avatar
      evio: expose evio_setsockopt_server function · 456e2a3c
      Vladislav Shpilevoy authored
      It is going to be used in SWIM module to set UDP server socket
      options. Apparently this function sets some usefull flags like
      NONBLOCK, REUSEADDR.
      456e2a3c
    • Vladislav Shpilevoy's avatar
      sio: introduce sio_uri_to_addr · 999bdc8b
      Vladislav Shpilevoy authored
      The function parses string URI consisting of either IP and port,
      or UNIX socket address, and stores the result into struct
      sockaddr.
      999bdc8b
    • Roman Khabibov's avatar
      httpc: set 'Unknown' reason for 0, 4xx, 5xx codes · 9d99d145
      Roman Khabibov authored
      Set the reason "Unknown" when it is CURLE_OK and status is more than or equal
      to 400.
      
      Closes #3681
      9d99d145
    • Roman Khabibov's avatar
      box: fix bug with module_reload() without box.cfg{} · 3ccd5568
      Roman Khabibov authored
      A bug existed because module_init was called during a call to box_cfg{}.
      Modules were not initialized before calling box.cfg{}.
      
      Closes #3770
      3ccd5568
    • Ivan Koptelov's avatar
      sql: remove struct Table · ff75878a
      Ivan Koptelov authored
      Lets completely remove struct Table. Also the patch simplifies memory
      management as in many cases struct space (which replaces struct Table)
      is allocated on region and shouldn't be explicitly freed.  Some wrappers
      fetching data from space (such as space_checks_expr_list) have been
      removed since now we can get all properties right from space object
      right from cache.
      
      Closes #3235
      ff75878a
    • Vladimir Davydov's avatar
      replication: improve join/subscribe logging · b49917b8
      Vladimir Davydov authored
      This patch makes logging a little bit more verbose so as to facilitate
      post-mortem replication failure analysis:
      
       - When an instance starts up, print its uuid and vclock.
       - When a replica connects to a master, print the master's uuid to
         the replica's log.
       - Print replica uuid and address to the master's log on join/subscribe.
       - Log local and remote vclock on subscribe, both on master and on
         replica.
       - Log ids assigned to replicas both on recovery and when online.
         Also, log when a replica is deleted from the cluster.
      b49917b8
    • Vladimir Davydov's avatar
      box: don't set cluster uuid and instance id in initial snapshot · 3fe8c283
      Vladimir Davydov authored
      They aren't needed there as we reset them anyway once the snapshot is
      replayed on initial bootstrap. OTOH having them results in calling
      replica_{set,clear}_id twice on initial bootstrap, which will look weird
      when I patch them to log the ids. So let's remove them from the initial
      snapshot. This makes the initial bootstrap impossible to recover from as
      it is, but that shouldn't be an issue since one can always bootstrap a
      new instance in a normal way. This also allows us to make cluster uuid
      truly immutable (currently, one can update it with REPLACE).
      3fe8c283
    • Vladimir Davydov's avatar
      vclock: use static buffer to format vclock · 61f47446
      Vladimir Davydov authored
      Currently, vclock_to_string() allocates the formatted vclock string
      using malloc() and hence the caller is responsible for freeing it, which
      isn't very user-friendly. Let's use a static buffer as we do to format
      other objects.
      61f47446
  5. Feb 14, 2019
  6. Feb 13, 2019
    • Vladimir Davydov's avatar
      tuple: fix integer boundaries check in tuple_hash_field · 47bf2393
      Vladimir Davydov authored
      exp() is base-e exponential function. Apparently, we must use exp2()
      here to correctly check 64-bit integer boundaries.
      
      Fixes commit 0dfd99c4 ("tuple: fix hashing of integer numbers").
      
      Follow-up #3907
      47bf2393
    • Vladimir Davydov's avatar
      vinyl: fix double to size_t conversion in vy_regulator_update_rate_limit · 87994f22
      Vladimir Davydov authored
      Fixes commit adb78d55 ("vinyl: throttle tx to ensure compaction
      keeps up with dumps").
      
      Follow-up #3721
      87994f22
    • Vladimir Davydov's avatar
      vinyl: throttle tx to ensure compaction keeps up with dumps · adb78d55
      Vladimir Davydov authored
      Every byte of data written to a vinyl database eventually gets compacted
      with data written to the database earlier. The ratio of the size of data
      actually written to disk to the size of data written to the database is
      called write amplification. Write amplification depends on the LSM tree
      configuration and the workload parameters and varies in a wide range,
      from 2-3 to 10-20 or even higher in some extreme cases. If the database
      engine doesn't manage to write those extra data, LSM tree shape will get
      distorted, which will result in increased read and space amplification,
      which, in turn, will lead to slowing down reads and wasting disk space.
      That's why it's so important to ensure the database engine has enough
      compaction power.
      
      One way to ensure that is increase the number of compaction threads by
      tuning box.cfg.vinyl_write_threads configuration knob, but one can't
      increase it beyond the capacity of the server running the instance. So
      the database engine must throttle writes if it detects that compaction
      threads are struggling to keep up. This patch implements a very simple
      algorithm to achieve that: it keeps track of recently observed write
      amplification and data compaction speed, use them to calculate the max
      transaction rate that the database engine can handle while steadily
      maintaining the current level of write amplification, and sets the rate
      limit to 0.75 of that so as to give the engine enough room to increase
      write amplification if needed.
      
      The algorithm is obviously pessimistic: it undervalues the transaction
      rate the database can handle after write amplification has steadied. But
      this is compensated by its simplicity and stability - there shouldn't be
      any abrupt drops or peaks in RPS due to its decisions. Besides, it
      adapts fairly quickly to increase in write amplification when a database
      is filled up. If one finds that the algorithm is being too cautious by
      undervaluing the limit, it's easy to fix by simply increasing the number
      of compaction threads - the rate limit will scale proportionately if the
      system is underloaded.
      
      The current value of the rate limit set by the algorithm is reported by
      box.stat.vinyl() under regulator.rate_limit section.
      
      Thanks to @kostja for the great comment explaining the logic behind the
      rate limiting algorithm.
      
      Closes #3721
      adb78d55
    • Vladimir Davydov's avatar
      vinyl: don't consume quota if wait queue isn't empty · 9b11bf9f
      Vladimir Davydov authored
      vy_quota_use only checks if there's enough quota available for consumer
      to proceed, but that's not enough, because it may occur that there are
      fibers already waiting for the resource. Bypassing them may result in
      starvation, which manifests itself as "waited for vinyl memory quota for
      too long" warnings. To ensure fairness and avoid starvation, let's go to
      sleep if the wait queue is not empty.
      9b11bf9f
    • Vladimir Davydov's avatar
      vinyl: remove extra quota check from vy_quota_use · abdb1291
      Vladimir Davydov authored
      Before waking up a fiber that is waiting for quota, we always first
      check if it can actually consume it, see vy_quota_signal. Hence the
      extra check in vy_quota_use is needed only to prevent spurious wakeups.
      It doesn't seem to be wise to add such a check to a hot path as a
      counter-mesaure to such an unlikely scenario. Let's remove it - after
      all it isn't critical if a spuriously woken up fiber exceeds the limit.
      abdb1291
    • Vladimir Davydov's avatar
      vinyl: introduce quota consumer types · 3196be5e
      Vladimir Davydov authored
      Currently, we only limit quota consumption rate so that writers won't
      hit the hard limit before memory dump is complete. However, it isn't
      enough, because we also need to consider compaction: if it doesn't keep
      up with dumps, read and space amplification will grow uncontrollably.
      
      The problem is compaction may be a quota consumer by itself, as it may
      generate deferred DELETE statements for secondary indexes. We can't
      ignore quota completely there, because if we do, we may hit the memory
      limit and stall all writers, which is unacceptable, but we do want to
      ignore the rate limit imposed to make sure that compaction keeps up with
      dumps, otherwise compaction won't benefit from such a throttling.
      
      To tackle this problem, this patch introduces the concept of quota
      consumer types and resources. Now vy_quota maintains one rate limit per
      each resource and one wait queue per each consumer type. There are two
      types of consumers, compaction jobs and usual transactions, and there
      are two resources managed by vy_quota, disk and memory. Memory-based
      rate limit ensures that transactions won't hit the hard memory limit and
      stall before memory dump is complete. It is respected by all types of
      consumers. Disk-based rate limit is supposed to be set when compaction
      doesn't keep up with dumps. It is only used by usual transactions and
      ignored by compaction jobs.
      
      Since now there are two wait queues, we need to balance wakeups between
      them in case consumers in both queues are ready to proceed. To ensure
      there's no starvation, we maintain a monotonically growing counter and
      assign its value to each consumer put to slip (ticket). We use it to
      wake up the consumer that has waited most when both queues are ready.
      
      Note, the patch doesn't implement the logic of disk-based throttling in
      the regulator module. It is still left for future work.
      
      Needed for #3721
      3196be5e
    • Шипицын Анатолий's avatar
      Add option interface for set source interface in http client · 99272d7b
      Шипицын Анатолий authored
      @TarantoolBot document
      Title: 'interface' http.client option
      It allows to set source network interface for an outgoing
      connection using the interface name or IP address.
      For additional info see https://curl.haxx.se/libcurl/c/CURLOPT_INTERFACE.html
      99272d7b
    • Nikita Pettik's avatar
      sql: clean-up SQLite mentions in codebase · 73e85ae5
      Nikita Pettik authored
      Replace all usage of sqlite3_, sqlite, SQLite prefixes with simple sql_
      All other occurrences of SQLite are substituted with SQL word.
      SQL test suit is purified as well.
      73e85ae5
  7. Feb 12, 2019
Loading