Skip to content
Snippets Groups Projects
  1. Dec 09, 2024
    • Georgy Moshkin's avatar
      box: introduce space type · ea8aaf24
      Georgy Moshkin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Introduces a new field `type` to the space definition. Currently it can
      only be "normal" or "data-temporary". It is backwards compatible with
      temporary=true.
      
      @TarantoolBot document
      Title: Introduce space field type
      
      A new space definition field "type" can now be used to specify the type
      of the space. Usage: box.schema.create_space("s", { type = "normal" }).
      Currently only 2 types are supported: "normal" & "data-temporary", which
      is equivalent to { temporary = true }. Old-style { temporary = true } is
      still supported, but only one option either 'temporary' or 'type' may be
      specified at the same time.
      
      Space type "temporary" will be introduced in a later commit.
      In the future options "local", "synchronous", etc. may also be
      supported.
      
      NO_TEST=will be tested in the following commit
      ea8aaf24
    • Aleksandr Lyapunov's avatar
      sql: refactor update_view_references a bit · d6d918bb
      Aleksandr Lyapunov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      The function update_view_references is called when an SQL view
      is created or dropped. The goal of this function is to modify
      (increment or decrement) view_ref_count member of spaces that
      the view references.
      
      There were a several issues that deserves to be refactored:
      * By design in case of error it left the job partially done, so
        some space references were modified while some other - not.
        Although there was no bug since special steps were made in case
        of error, this pattern is inconvenient and should be avoided.
      * In case of error the failing space name was returned via special
        argument which is not flexible and even requires allocation.
      * Another argument - suppress_error - has actually never
        suppressed any error because the only case when an error could
        occur is creation of a view, which used suppress_error = false.
      * Fail of that function was not actually covered with tests.
      
      So this commit:
      * Makes the function to do all or nothing.
      * Forces the function to set diag by itself in case of error.
      * Removes suppress_error argument while adding several asserts.\
      * Adds a small test that fulfills coverage.
      
      NO_DOC=refactoring
      NO_CHANGELOG=reafactoring
      d6d918bb
    • Aleksandr Lyapunov's avatar
      sql: don't store the first NULL element in list · 12978da0
      Aleksandr Lyapunov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      By design a newly created SrcList object contains one element
      with NULL name. That was confusing and led to strange NULL checks
      in a list that could not contain NULL names.
      
      Fix it by clearing the list before usage.
      
      NO_DOC=refactoring
      NO_CHANGELOG=reafactoring
      NO_TEST=refactoring
      12978da0
    • Aleksandr Lyapunov's avatar
      sql: don't catch OOM in sql_select_expand_from_tables · 2203d420
      Aleksandr Lyapunov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Since we panic on OOM now, no OOM error handling is needed now.
      Fix both internals of the function and how it is used in alter.
      
      NO_DOC=refactoring
      NO_CHANGELOG=reafactoring
      NO_TEST=refactoring
      2203d420
    • Dmitry Ivanov's avatar
      feat(tests): Explain the reason why LDAP test might fail locally · 34ec6fa9
      Dmitry Ivanov authored
      NO_DOC=internal
      NO_TEST=internal
      NO_CHANGELOG=internal
      34ec6fa9
    • Ilya Verbin's avatar
      box: support default field values in the space format · 9ec54fa3
      Ilya Verbin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Now a field can be assigned a default value in the space format. When a new
      tuple is inserted into a space, and some of the fields contain null values,
      those fields will be filled with their respective default values.
      
      Closes #8157
      
      @TarantoolBot document
      Title: Document default field values
      Product: Tarantool
      Since: 3.0
      Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/format/
      
      The format clause contains, for each field, a definition within braces:
      `{name='...',type='...'[,is_nullable=...][,default=...]}`, where:
      
      * the optional `default` value contains a default value for the field.
        Its type must be compatible with the field type. If default value is set,
        it is applied regardless of whether `is_nullable` is true or false.
      
      Example:
      
      ```lua
      tarantool> box.space.tester:format{
               > {name = 'id', type = 'unsigned'},
               > {name = 'name', type = 'string', default = 'Noname'},
               > {name = 'pass', type = 'string'},
               > {name = 'shell', type = 'string', default = '/bin/sh'}}
      ---
      ...
      
      tarantool> box.space.tester:insert{1000, nil, 'qwerty'}
      ---
      - [1000, 'Noname', 'qwerty', '/bin/sh']
      ...
      ```
      9ec54fa3
    • Ilya Verbin's avatar
      box: introduce tuple_builder class · e92db8b7
      Ilya Verbin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      It encapsulates the logic that helps to build a new MsgPack array by
      concatenating tuple fields from various locations. The idea is to
      postpone memory allocation and copying until the finalization.
      
      Needed for #8157
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      e92db8b7
    • Ilya Verbin's avatar
      sql: rename field_def::default_value to field_def::sql_default_value · 5a3b017f
      Ilya Verbin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      In order to avoid collision with the upcoming core default_value.
      
      Also rename tuple_field::default_value_expr to
      tuple_field::sql_default_value_expr.
      
      Part of #8157
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      5a3b017f
    • Maksim Kaitmazian's avatar
      build: add exports for a simple query flow · 5fe445b2
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      PG protocol run queries by calling dispatch_query, which stores the
      response in port_c contained in box_function_ctx structure.
      
      NO_DOC=exports
      NO_CHANGELOG=exports
      NO_TEST=exports
      5fe445b2
    • Maksim Kaitmazian's avatar
      feat: implement user_auth_method_name · 2680f19a
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      This function is used to determine the authentication method when
      authenticating a postgres client.
      
      part of picodata/picodata/sbroad!292
      
      NO_DOC=exports
      NO_CHANGELOG=exports
      NO_TEST=exports
      2680f19a
    • Maksim Kaitmazian's avatar
      build: add exports for PG authentication · 780b5011
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      These exports allow us to perform user authentication and
      network communication.
      
      part of picodata/picodata/sbroad!292
      
      NO_DOC=exports
      NO_CHANGELOG=exports
      NO_TEST=exports
      780b5011
    • Georgy Moshkin's avatar
      fiber: introduce fiber_set_name_n function · 08413b81
      Georgy Moshkin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      08413b81
    • Dmitry Ivanov's avatar
      fix(cmake): Don't download GLAuth for LDAP tests by default · bbcde439
      Dmitry Ivanov authored
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      bbcde439
    • Dmitry Ivanov's avatar
      fix: Take `auth_type` into account in `console.connect` · 51669ff9
      Dmitry Ivanov authored
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      51669ff9
    • Dmitry Ivanov's avatar
      fix: Add changelog for LDAP · 08ca239e
      Dmitry Ivanov authored
      Better late than never.
      08ca239e
    • Dmitry Ivanov's avatar
      fix: Establish LDAP connections implicitly · c06d234b
      Dmitry Ivanov authored
      Unfortunately, Centos 7 provides only openssl 1.0.2 (at lest if we
      disregard epel), so we can't build the bundled libldap & libsasl2.
      "Okay", one might think, "we can link against the distro's libs".
      Well, turns out libldap 2.4, which is what we have to deal with in
      that case, doesn't have ldap_connect!
      
      Luckily, we don't have to connect explicitly. According to man pages:
      
      ```
      ldap_init() acts just like ldap_open(), but does not open a connection
      to the LDAP server.  The actual connection open will occur when the
      first operation is attempted.
      
      ldap_initialize()  acts  like ldap_init()...
      ```
      
      This is still true for libldap up to and including version 2.6.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      c06d234b
    • Dmitry Ivanov's avatar
      fix: Add extra byproducts to bundled ldap & sasl · 0846d826
      Dmitry Ivanov authored
      This is needed to fix Ninja, which requires them to
      build a dependency graph.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      0846d826
    • Dmitry Ivanov's avatar
      feat: Add `auth_type` to box.schema.user.create() · e6c77fc4
      Dmitry Ivanov authored
      Now it's possible to specify the desired authentication method during
      user creation via `auth_type`, e.g.
      
      ```lua
      box.schema.user.create('mickey', { auth_type = 'chap-sha1',
                                         password = 'foobar' })
      ```
      
      Furthermore, authentication methods may now specify that they don't
      require password to create stored authentication info. This is used
      in LDAP authentication (`auth_type = 'ldap'`):
      
      ```lua
      box.schema.user.create('mickey', { auth_type = 'ldap' })
      ```
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      e6c77fc4
    • Dmitry Ivanov's avatar
      feat: Implement LDAP authentication · 71778554
      Dmitry Ivanov authored
      This authentication method doesn't store any secrets; instead,
      we delegate the whole auth to a pre-configured LDAP server. In
      the method's implementation, we connect to the LDAP server and
      perform a BIND operation which checks user's credentials.
      
      Usage example:
      
      ```lua
      -- Set the default auth method to LDAP and create a new user.
      -- NOTE that we still have to provide a dummy password; otherwise
      -- box.schema.user.create will setup an empty auth data.
      box.cfg({auth_type = 'ldap'})
      box.schema.user.create('demo', { password = '' })
      
      -- Configure LDAP server connection URL and DN format string.
      os = require('os')
      os.setenv('TT_LDAP_URL', 'ldap://localhost:1389')
      os.setenv('TT_LDAP_DN_FMT', 'cn=$USER,ou=users,dc=example,dc=org')
      
      -- Authenticate using the LDAP authentication method via net.box.
      conn = require('net.box').connect(uri, {
          user = 'demo',
          password = 'password',
          auth_type = 'ldap',
      })
      ```
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      71778554
    • Dmitry Ivanov's avatar
      feat: Pass user to auth_method::authenticator_check_request · b9f9a4d5
      Dmitry Ivanov authored
      This is required for LDAP authentication, because we need
      username to format the corresponding DN.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      b9f9a4d5
    • Maksim Kaitmazian's avatar
      fix: box.schema.user.passwd doesn't change the password · b766a14b
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      box.schema.user.passwd doesn't change the password for the current
      user because new password is passed instead of the user name.
      
      NO_CHANGELOG=fix an unreleased bug
      NO_DOC=fix an unreleased bug
      b766a14b
    • Maksim Kaitmazian's avatar
      fix: allow empty password and username in MD5 · 763be7b3
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      It fixes the following assertion
      ```bash
      tarantool: ./src/lib/core/crypt.c:84: md5_encrypt:
      Assertion `password_len + salt_len > 0' failed.
      ```
      caused by the following code
      ```lua
      box.cfg{auth_type='md5'}
      box.schema.user.password("")
      ```
      
      NO_CHANGELOG=fix an unreleased feature
      NO_DOC=fix an unreleased feature
      763be7b3
    • Maksim Kaitmazian's avatar
      feat: make user name argument optional · 6b385e43
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      part of picodata/tarantool#21
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      6b385e43
    • Дмитрий Кибирев's avatar
      fix: save old deb-packages · 733f49f7
      Дмитрий Кибирев authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      NO_DOC=ci change
      NO_TEST=ci change
      NO_CHANGELOG=ci change
      733f49f7
    • Arseniy Volynets's avatar
      fix(ci): compile error for centos/altlinux · 6da5be5e
      Arseniy Volynets authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Previous commit caused CI `pack` job
      to fail on some linux distros. This
      commit fixes the warnings from compiler.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      6da5be5e
    • Arseniy Volynets's avatar
      feat: add limit for max executed vdbe opcodes · 032e2659
      Arseniy Volynets authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      - Add a configurable non-negative
      session parameter "sql_vdbe_max_steps"
      -- max number of opcodes that Vdbe
      is allowed to execute for sql query.
      
      - Default value can be specified in box.cfg.
      If not set via box.cfg, default value
      is 45000. Value 0 means that no
      checks for number of executed Vdbe
      opcodes will be made.
      
      - Add the third argument to box.execute
      function, that allows to specify options
      for query execution. The only option
      supported: sql_vdbe_max_steps. Usage
      example:
      
      ```
      box.execute([[select * from t]], {}, {{sql_vdbe_max_steps = 1000}})
      ```
      
      part of picodata/picodata/sbroad!461
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      032e2659
    • Maksim Kaitmazian's avatar
      feat: implement md5 authentication · 30038100
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      It prevents password sniffing and avoids storing passwords on the
      server in plain text but provides no protection if an attacker
      manages to steal the password hash from the server.
      
      Usage example:
      ```lua
      -- Enable the md5 authentication method for all new users.
      box.cfg({auth_type = 'md5'})
      
      -- Reset existing user passwords to use the md5 authentication method.
      box.schema.user.passwd('alice', 'topsecret')
      
      -- Authenticate using the md5 authentication method via net.box.
      conn = require('net.box').connect(uri, {
          user = 'alice',
          password = 'topsecret',
          -- Specifying the authentication method isn't strictly necessary:
          -- by default the client will use the method set in the remote
      	-- server config (box.cfg.auth_type)
          auth_type = 'md5',
      })
      ```
      
      part of picodata/picodata/sbroad!377
      
      @TarantoolBot document
      Title: md5 authentication method
      
      See the commit message.
      30038100
    • Maksim Kaitmazian's avatar
      feat: add user name argument to `auth_method` api · e749fbf1
      Maksim Kaitmazian authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      User name is usually used as a salt for user password in order to
      avoid password repeating.
      For instance, postgres md5 authentication stores passwords as
      md5("password", "user"), so that the same passwords are represented by
      different hashes.
      
      part of picodata/picodata/sbroad!377
      
      @TarantoolBot document
      Title: Document updated `box.schema.user.password` declaration.
      
      Since auth methods can use user name for hashing, user name is
      added to argument list of `box.schema.user.password`.
      
      NO_TEST=there are no methods that use user name
      e749fbf1
    • godzie44's avatar
      fix: use-after-free in `cbus_endpoint_delete` · 5b2fb5dd
      godzie44 authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Calling a `TRASH` macro after calling the `free`
      function dereferences the pointer to the already
      freed memory.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      5b2fb5dd
    • Gleb Kashkin's avatar
      console: fix :endswith() err in tntctl connection · 71d87e97
      Gleb Kashkin authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      There used to be a rare error when failed to connect via tarantoolctl to
      listening cartridge console. It was caused by unclear
      console.local_print() contract. Starting from gh-7031 fix, the function
      assumed string-only arguments, while in some cases cdata error was
      passed.
      
      Now console.local_print() prints all non-string arguments as is, without
      modifying potential local_eos.
      
      Closes #8374
      
      NO_DOC=bugfix
      NO_TEST=very hard to test
      71d87e97
    • Denis Smirnov's avatar
      fix: tuple hash calculation tests · b8e801cb
      Denis Smirnov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Tuple hash calculation tests for the C API were incorrect. Thanks
      to the full pipeline with DEBUG build we detected the problem and
      fixed it.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      b8e801cb
    • Denis Smirnov's avatar
      feat: expose tuple hash calculation method · e1ce65e8
      Denis Smirnov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Picodata supports cluster-wide SQL and needs some predictable
      method to calculate tuple hashes for the bucket ids. Method
      should be available for Lua, C and Rust users. It was decided
      to expose a murmur3 hash calculation method of the key_def module.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      e1ce65e8
    • godzie44's avatar
      cbus: introduce lcpipe - light cpipe · d653d088
      godzie44 authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Introduced a new type of cbus pipe - lcpipe. The current pipe in the
      cbus - cpipe, has a number of limitations, first of all - the cpipe
      cannot be used from the 3rd party threads, cpipe only works as a channel
      between two cords. That why lcpipe is needed. Its main responsibility -
      create channel between any thread and tarantool cord.
      
      Internally lcpipe is a cpipe, but:
      - on flush triggers removed, cause triggers use thread-local mem-pool,
      this is not possible on a third party thread
      - producer event loop removed, cause there is no libev event loop in
      third party thread
      
      Also, lcpipe interface is exported to the outside world.
      
      NO_DOC=core feature
      d653d088
    • Дмитрий Кольцов's avatar
      build(CMakeLists.txt): disable feedback daemon by default · 7900c396
      Дмитрий Кольцов authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      NO_DOC=disable feedback
      NO_TEST=disable feedback
      7900c396
    • Дмитрий Кольцов's avatar
      fix(schema version): fix some types that were not updated to 64 bit · f0b9104f
      Дмитрий Кольцов authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      NO_DOC=core feature
      NO_TEST=no Lua API
      NO_CHANGELOG=bugfix
      f0b9104f
    • Дмитрий Кольцов's avatar
      feat(json): add option to encode decimals as string · a85eebb6
      Дмитрий Кольцов authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Due to inconsistency of Tarantool type casting while using strict
      data types as "double" or "unsigned" it is needed
      to use "number" data type in a whole bunch of cases.
      However "number" may contain "decimal" that will be serialized into
      string by JSON builtin module.
      
      This commit adds "encode_decimal_as_number" parameter to json.cfg{}.
      That forces to encode `decimal` as JSON number to force type
      consistency in JSON output.
      Use with catious - most of JSON parsers assume that number is restricted
      to float64.
      
      NO_DOC=we do not host doc
      a85eebb6
    • Denis Smirnov's avatar
      sql: fix string dequoting · 5ace8287
      Denis Smirnov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      
      Previously,
      
      select "t1"."a" from (select "a" from "t") as "t1";
      
      returned a result column name `t1` instead of `t1.a` because of
      incorrect work of a dequoting function. The reason was that
      previously sqlDequote() function finished its work when found the
      first closing quote.
      
      Old logic worked for simple selects where the column name doesn't
      contain an explicit scan name ("a" -> a).
      But for the sub-queries results sqlDequote() finished its work right
      after the scan name ("t1"."a" -> t1). Now the function continues its
      deqouting till it gets the null terminator at the end of the string.
      
      Closes #7063
      
      NO_DOC=don't change any public API, only a bug fix
      
      Co-authored-by: default avatarMergen Imeev <imeevma@gmail.com>
      5ace8287
    • Denis Smirnov's avatar
      sql: recompile expired prepared statements · de6e983a
      Denis Smirnov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Actually there is no reason to throw an error and make a user
      manually recreate prepared statement when it expires. A much more
      user friendly way is to recreate it under hood when statement's
      schema version differs from the box one.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      de6e983a
    • Denis Smirnov's avatar
      fix: default result parameter type · 6aefda71
      Denis Smirnov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      Problem description.
      
      When we prepare a statement with parameters in the result columns
      (for example box.prepare('select ?')) Tarantool has no information
      about the type of the output column and set it to default boolean.
      Then, on the execution phase, the type would be recalculated during
      the parameter binding.
      
      Tarantool expects that there is no way for parameter to appear in the
      result tuple other than exactly be mentioned in the final projection.
      But it is incorrect - we can easily propagate parameter from the inner
      part of the join. For example
      
      box.prepare([[select COLUMN_1 from t1 join (values (?)) as t2 on true]])
      
      In this case column COLUMN_1 in the final projection is not a
      parameter, but a "reference" to it and its type depends on the
      parameter from the inner part of the join. But as Tarantool
      recalculates only binded parameters in the result projection,
      it doesn't change the default boolean metadata type of the COLUMN_1
      and the query fails on comparison with the actual type of the tuple.
      
      Solution.
      As we don't want to patch Vdbe to make COLUMN_1 refer inner parameter,
      it was decided to make a simple workaround: change the default
      column type from BOOLEAN to ANY for parameters. It fixes the
      comparison with the actual tuple type (we do not fail), but in some
      cases get ANY column in the results where we would like to have
      explicitly defined type. Also NULL parameters would also have ANY
      type, though Tarantool prefers to have BOOLEAN in this case.
      
      Closes https://github.com/tarantool/tarantool/issues/7283
      
      NO_DOC=bug fix
      6aefda71
    • godzie44's avatar
      sql: add sql_execute_prepared_ext function, same as sql_execute_prepared but... · 4db44efa
      godzie44 authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      sql: add sql_execute_prepared_ext function, same as sql_execute_prepared but without `region` parameter
      closes #2
      
      NO_DOC=minor
      NO_TEST=minor
      4db44efa
Loading