Skip to content
Snippets Groups Projects
  1. Apr 17, 2020
  2. Apr 16, 2020
    • Mergen Imeev's avatar
      sql: do not change order of inserted values · 2cc7e608
      Mergen Imeev authored
      Before this patch, if an ephemeral space was used during INSERT or
      REPLACE, the inserted values were sorted by the first column,
      since this was the first part of the index. This can lead to an
      error when using the AUTOINCREMENT feature, since changing the
      order of the inserted value can change the value inserted instead
      of NULL. To avoid this, the patch makes the rowid of the inserted
      row in the ephemeral space the only part of the ephemeral space
      index.
      
      Closes #4256
      2cc7e608
    • Mergen Imeev's avatar
      sql: specify field types in ephemeral space format · 2103f587
      Mergen Imeev authored
      This patch specifies field types in ephemeral space format in SQL.
      Prior to this patch, all fields had a SCALAR field type.
      
      This patch allows us to not use the primary index to obtain field
      types, since now the ephemeral space has field types in the
      format. This allows us to change the structure of the primary
      index, which helps to solve the issue #4256. In addition, since we
      can now set the field types of the ephemeral space, we can use
      this feature to set the field types according to the left value of
      the IN operator. This will fix issue #4692.
      
      Needed for #4256
      Needed for #4692
      Closes #3841
      2103f587
    • Mergen Imeev's avatar
      box: extend ephemeral space format · 032de39f
      Mergen Imeev authored
      This patch allows to set field types and names in ephemeral space
      formats.
      
      Needed for #4256
      Needed for #4692
      Part of #3841
      032de39f
    • Serge Petrenko's avatar
      relay: move relay_schedule_pending_gc before status update · e7ffddce
      Serge Petrenko authored
      relay_schedule_pending_gc() is executed after relay status update,
      which made perfect sense before we've introduced local spaces rework, making
      local space operations use a special instance id: 0.
      Relay status update is performed only when the remote instance has
      reported a bigger vclock, than its previous one. However, we may have an
      entire WAL file filled with local space changes, in which case the
      changes won't be transmitted to replica, and it will report the same
      vclock as before, postponing the scheduled gc until a non-local row is
      created on master.
      
      Fix this by reordering relay_schedule_pending_gc() and relay status
      update. In case nothing new is added to pending_gc queue and replica
      clock is not updated, relay_schedule_pending_gc() will exit on the first
      loop iteration, so it doesn't add an overhead.
      
      Also make relay_schedule_pending_gc() use vclock_compare_ignore0() instead
      of plain vclock_compare().
      
      Follow-up #4114
      e7ffddce
  3. Apr 15, 2020
    • Mergen Imeev's avatar
      sql: add '\0' to the BLOB when it is cast to INTEGER · a39e6a01
      Mergen Imeev authored
      Prior to this patch, due to the absence of the '\0' character at
      the end of the BLOB, it was possible to get an error or incorrect
      result when using CAST() from BLOB to INTEGER or UNSIGNED. This
      has now been fixed, but the maximum length of a BLOB that could be
      cast to INTEGER or UNSIGNED was limited to 12287 bytes.
      
      Examples of wrong CAST() from BLOB to INTEGER:
      
      CREATE TABLE t (i INT PRIMARY KEY, a VARBINARY, b INT, c INT);
      INSERT INTO t VALUES (1, X'33', 0x33, 0x00), (2, X'34', 0x41, 0);
      
      Example of wrong result:
      
      SELECT CAST(a AS INTEGER) FROM t WHERE i = 1;
      
      Result: 33
      
      Example of error during CAST():
      
      SELECT CAST(a AS INTEGER) FROM t WHERE i = 2;
      
      Result: 'Type mismatch: can not convert varbinary to integer'
      
      Closes #4766
      a39e6a01
    • Mergen Imeev's avatar
      sql: fix implicit cast from STRING to INTEGER · 6e6de43c
      Mergen Imeev authored
      Prior to this patch, STRING, which contains the DOUBLE value,
      could be implicitly cast to INTEGER. This was done by converting
      STRING to DOUBLE and then converting this DOUBLE value to INTEGER.
      This may affect the accuracy of CAST(), so it was forbidden. It
      is worth noting that these changes will not affect the comparison,
      since the implicit cast in this case has different mechanics.
      
      Example:
      box.execute("CREATE TABLE t(i INT PRIMARY KEY);")
      
      Before patch:
      box.execute("INSERT INTO t VALUES ('111.1');")
      box.execute("SELECT * FROM t;")
      Result: 111
      
      After patch:
      box.execute("INSERT INTO t VALUES ('1.1');")
      Result: 'Type mismatch: can not convert 1.1 to integer'
      
      box.execute("INSERT INTO t VALUES ('1.0');")
      Result: 'Type mismatch: can not convert 1.0 to integer'
      
      box.execute("INSERT INTO t VALUES ('1.');")
      Result: 'Type mismatch: can not convert 1. to integer'
      
      @TarantoolBot document
      Title: disallow cast from STRING contains DOUBLE to INTEGER
      
      After the last two patches, explicit and implicit casting from the
      string containing DOUBLE to INTEGER directly will be prohibited.
      The user must use the explicit cast to DOUBLE before the explicit
      or implicit cast to INTEGER. The reason for this is that before
      these patches, such STRINGs were implicitly cast to DOUBLE, and
      then this DOUBLE was implicitly or explicitly cast to INTEGER.
      Because of this, the result of such a cast may differ from what
      the user expects, and the user may not know why.
      
      It is worth noting that these changes will not affect the
      comparison, since the implicit cast in this case has different
      mechanics.
      
      Example for implicit cast:
      
      box.execute("CREATE TABLE t(i INT PRIMARY KEY);")
      -- Does not work anymore:
      box.execute("INSERT INTO t VALUES ('1.1');")
      -- Right way:
      box.execute("INSERT INTO t VALUES (CAST('1.1' AS DOUBLE));")
      
      Example for explicit cast:
      
      -- Does not work anymore:
      box.execute("SELECT CAST('1.1' AS INTEGER);")
      -- Right way:
      box.execute("SELECT CAST(CAST('1.1' AS DOUBLE) AS INTEGER);")
      6e6de43c
    • Mergen Imeev's avatar
      sql: fix CAST() from STRING to INTEGER · 11352a32
      Mergen Imeev authored
      Prior to this patch, STRING, which contains the DOUBLE value,
      could be cast to INTEGER. This was done by converting STRING to
      DOUBLE and then converting this DOUBLE value to INTEGER. This may
      affect the accuracy of CAST(), so it was forbidden.
      
      Before patch:
      box.execute("SELECT CAST('111.1' as INTEGER);")
      Result: 111
      
      After patch:
      box.execute("SELECT CAST('1.1' as INTEGER);")
      Result: 'Type mismatch: can not convert 1.1 to integer'
      
      box.execute("SELECT CAST('1.0' as INTEGER);")
      Result: 'Type mismatch: can not convert 1.0 to integer'
      
      box.execute("SELECT CAST('1.' as INTEGER);")
      Result: 'Type mismatch: can not convert 1. to integer'
      11352a32
    • Alexander V. Tikhonov's avatar
      gitlab-ci: move sources tarball creation to gitlab · 34f87bc6
      Alexander V. Tikhonov authored
      Moved sources tarball creation from travis-ci to gitlab-ci,
      moved its jobs for sources packing and sources deploying.
      
      Close #4895
      34f87bc6
    • Alexander V. Tikhonov's avatar
      Divide box/ddl.test.lua test · 4a8d1ebd
      Alexander V. Tikhonov authored
      Divided into tests:
      - box/ddl_alter.test.lua
      - box/ddl_collation.test.lua
      - box/ddl_collation_types.test.lua
      - box/ddl_collation_wrong_id.test.lua
      - box/ddl_no_collation.test.lua
      - box/ddl_parallel.test.lua
      - box/ddl_tuple.test.lua
      - box/gh-2336-ddl_call_twice.test.lua
      - box/gh-2783-ddl_lock.test.lua
      - box/gh-2839-ddl_custom_fields.test.lua
      - box/gh-2937-ddl_collation_field_def.test.lua
      - box/gh-3290-ddl_collation_deleted.test.lua
      - box/gh-928-ddl_truncate.test.lua
      4a8d1ebd
    • Alexander V. Tikhonov's avatar
      gitlab-ci: remove Ubuntu 19.04 Disco · 05df6b31
      Alexander V. Tikhonov authored
      Removed Ubuntu 19.04 Disco from testing which is EOL.
      
      Close #4896
      05df6b31
    • Alexander V. Tikhonov's avatar
      Added ability to remove packages from S3 · d6c50af1
      Alexander V. Tikhonov authored
      Added ability to remove given in options package from S3. TO remove the
      needed package need to set '-r=<package name with version>' option,
      like:
        ./tools/update_repo.sh -o=<OS> -d=<DIST> -b=<S3 repo> \
          -r=tarantool-2.2.2.0
      it will remove all found appropriate source and binaries packages from
      the given S3 repository, also the meta files will be corrected there.
      
      Close #4839
      d6c50af1
    • Alexander.V Tikhonov's avatar
      Add help instruction on 'product' option · cccc989c
      Alexander.V Tikhonov authored
      Added instructions on 'product' option with examples.
      
      Part of #4839
      cccc989c
    • Alexander.V Tikhonov's avatar
      Enable script for saving packages in S3 for modules · 4527a4da
      Alexander.V Tikhonov authored
      Found that modules may have only binaries packages w/o sources
      packages. Script changed to be able to work with only binaries
      either sources packages.
      
      Part of #4839
      4527a4da
    • Alexander V. Tikhonov's avatar
      Add metafiles cleanup routines at S3 pack script · ed491409
      Alexander V. Tikhonov authored
      Added cleanup functionality for the meta files.
      Script may have the following situations:
      
       - package files removed at S3, but it still registered:
         Script stores and registers the new packages at S3 and
         removes all the other registered blocks for the sames
         files in meta files.
      
       - package files already exists at S3 with the same hashes:
         Script passes it with warning message.
      
       - package files already exists at S3 with the old hashes:
         Script fails w/o force flag, otherwise it stores and
         registers the new packages at S3 and removes all the other
         registered blocks for the sames files in meta files.
      
      Added '-s|skip_errors' option flag to skip errors on changed
      packages to avoid of exits on script run.
      
      Part of #4839
      ed491409
    • Alexander V. Tikhonov's avatar
      gitlab-ci: set static docker build release testing · 6f618d62
      Alexander V. Tikhonov authored
      Returned the static build based on Dockerfile to gitlab-ci release branches
      testing after the issues with missed openssl version fixed at PR #4831.
      
      Follow up #4831
      
      (cherry picked from commit b09f44b856e91f1006bd5b3e226a7be0b65b7859)
      6f618d62
    • Alexander V. Tikhonov's avatar
      build: disable cache for static build Dockerfile · c5d27312
      Alexander V. Tikhonov authored
      Found that static build based on Dockerfile used external link
      and missed that it was removed, like it was in #4830. To avoid
      of the same issues the cache for building the Dockerfile was
      disabled with '--no-cache' option at docker build command.
      
      Follow up #4830
      
      (cherry picked from commit 1207821e4fc18312a9916d81a55a8eacd75a67b3)
      c5d27312
    • Sergey Bronnikov's avatar
      Enable branch coverage in lcov · 5842157c
      Sergey Bronnikov authored
      By default lcov collects line coverage only. It would be useful to
      collect function and branch coverage too.
      
      Closes #4888
      5842157c
    • Sergey Bronnikov's avatar
      Fix flaky test engine/ddl · 5f96ee59
      Sergey Bronnikov authored
      Test was a flaky from the beginning 39d0e427
      Time of building indexes varies from time to time and the problem was due to
      abcense of synchronization in index building and checking numbers of these
      indexes.
      
      Fixes #4353
      5f96ee59
    • Serge Petrenko's avatar
      relay: fix segfault on replica transition from anonymous · 6fcf7959
      Serge Petrenko authored
      
      relay_subscribe_f sets a recovery trigger notifying tx when a full log
      is read and gc consumer corresponding to the replica may be advanced.
      Since anonymous replicas do not have gc consumers, the trigger isn't
      added for them. However, on relay exit, the trigger deletion depends
      on replica->anon flag. This is buggy in case relay stalls on exit due to
      replica disconnect. Replica has time to reconnect and register as a
      normal instance, hence its replica->anon flag will be false by the time
      we check whether to clear triggers or not, effectively making us to
      clear unset triggers and segfault.
      
      Fix this by initializing the triggers with trigger_create(), which
      allows a trigger_clear() call, even if the triggers are not set, and
      omit the replica->anon check.
      
      Closes #4731
      
      Acked-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
      6fcf7959
    • Serge Petrenko's avatar
      box: start counting local space requests separately · 7eb4650e
      Serge Petrenko authored
      Sign local space requests with a zero instance id. This allows to split
      local changes aside from the changes, which should be visible to the whole
      cluster, and stop sending NOPs to replicas to follow local vclock.
      
      Moreover, it fixes the following bug with local spaces and replication.
      In a situation when there are a master and a replica set up, replica may
      still write to local spaces even if it's read-only. Local space
      operations used to promote instance's lsn before this patch. Eventually,
      master would have vclock {1:x} and replica'd have vclock {1:x, 2:y},
      where y > 0, due to local space requests performed by the replica.
      If a snapshot happens on replica side, replica will delete it's .xlog
      files prior to the snapshot, since no one replicates from it and thus it
      doesn't have any registered GC consumers.
      From this point, every attempt to configure replication from replica to
      master will fail, since master will try to fetch records which account
      for the difference in master's and replica's vclocks: {1:x} vs {1:x,2:y},
      even though master will never need the rows in range {2:1} - {2:y},
      since they'll be turned to NOPs during replication.
      
      Starting from this patch, in the situation described above, replica's
      clock will be {0:y, 1:x}, and, since local space requests are now not
      replicated at all, master will be able to follow replica, turning the
      configuration to master-master.
      
      Closes #4114
      7eb4650e
    • Serge Petrenko's avatar
      gc: rely on minimal vclock components instead of signatures · 11804b46
      Serge Petrenko authored
      The current WAL GC implementation tracks consumers (i.e. remote replicas) by
      their vclock signature, which is the sum of all vclock components.
      This approach is wrong, and this can be shown by a little example.
      The example will be a little synthetic, but it'll illustrate the problem.
      Say, you have 2 masters, A and B with ids 1 and 2 respectively, and a replica C
      with id 3. Say, С replicates from both A and B, and there is no replication
      between A and B (say, the instances were reconfigured to not replicate from each
      other). Now, say replica C has followed A and B to vclock {1:5, 2:13}. At the
      same time, A has lsn 10 and B has lsn 15. A and B do not know about each other’s
      changes, so A’s vclock is {1:10} and B’s vclock is {2:15}. Now imagine A does a
      snapshot and creates a new xlog with signature 10. A’s directory will look like:
      00…000.xlog 00…010.snap 00….010.xlog
      Replica C reports its vclock {1:5, 2:13} to A, A uses the vclock to update the
      corresponding GC consumer. Since signatures are used, GC consumer is assigned a
      signature = 13 + 5 = 18. This is greater than the signature of the last xlog on
      A (which is 10), so the previous xlog (00…00.xlog) can be deleted (at least A
      assumes it can be). Actually, replica still needs 00…00.xlog, because it
      contains rows corresponding to vclocks {1:6} - {1:10}, which haven’t been
      replicated yet.
      
      If instead of using vclock signatures, gc consumers used vclocks, such a problem
      wouldn’t arise. Replica would report its vclock {1:5, 2:13}. The vclock is NOT
      strictly greater than A’s most recent xlog vclock ({1:10}), so the previous log
      is kept until replica reports a vclock {1:10, 2:something} or {1:11, …} and so
      on.
      
      Rewrite gc to perform cleanup based on finding minimal vclock
      components present in at least one of the consumer vclocks instead of
      just comparing vclock signatures.
      
      Prerequisite #4114
      11804b46
    • Serge Petrenko's avatar
      replication: omit 0-th vclock component in replication responses · 93ae77fc
      Serge Petrenko authored
      If an anonymous replica is promoted to a normal one and becomes
      replication master later, its vclock contains a non-empty zero
      component, tracking local changes on this replica from the time when it
      had been anonymous. No need to pollute joining instance's vclock with
      our non-empty 0 component.
      When an anonymous replica reports its status to a remote instance it
      should also hide its 0-th vclock component.
      
      This is needed for backward compatibility with old instances, which
      don't ignore 0th vclock component coming from a remote instance by
      default.
      
      In order to do so, introduce a new function - vclock_size_ignore0(),
      which doesn't count 0th clock component, and patch xrow_encode_vclock()
      to skip 0th clock component if it's present.
      
      Also make sure that new instances ignore 0th vclock component coming
      from an unpatched remote instance.
      
      Follow-up #3186
      Prerequisite #4114
      93ae77fc
  4. Apr 14, 2020
    • Vladislav Shpilevoy's avatar
      box: export box_session_push to the public C API · 5d795527
      Vladislav Shpilevoy authored
      API is different from box.session.push() - sync argument was
      removed. It will disappear from Lua API as well, because it just
      is not needed here. Session is omitted as well. Indeed, a user
      can't push to a foreign session, and the current session can be
      obtained inside box_session_push(). And anyway session is not in
      the public C API.
      
      Internally dump into iproto is done using obuf_dup(), just like
      tuple_to_obuf() does. obuf_alloc() would be a bad call here,
      because it wouldn't be able to split the pushed data into several
      obuf chunks, and would cause obuf fragmentation.
      
      Dump into plain text behaves just like a Lua push - it produces a
      YAML formatted text or Lua text depending on output format. But to
      turn MessagePack into YAML or Lua text an intermediate Lua
      representation is used, because there are no a MessagePack -> YAML
      and MessagePack -> Lua text translators yet.
      
      Closes #4734
      
      @TarantoolBot document
      Title: box_session_push() C API
      
      There is a new function in the public C API:
      ```C
          int
          box_session_push(const char *data, const char *data_end);
      ```
      
      It takes raw MessagePack, and behaves just like Lua
      `box.session.push()`.
      5d795527
Loading