- Oct 18, 2022
-
-
Ilya Verbin authored
By default a user might not have privileges to access the _schema space, that will cause an error during schema_needs_upgrade(), which calls get_version(). Fix this by using C variable dd_version_id, which is updated in the _schema.version replace trigger. There's a special case for upgrade() during bootstrap() - triggers are disabled during bootstrap, that's why dd_version_id is not being updated. Handle this by passing _initial_version=1.7.5 to the upgrade function. Part of #7149 NO_DOC=internal NO_CHANGELOG=internal
-
- Sep 29, 2022
-
-
Andrey Saranchin authored
The patch introduces C and Lua methods for extracting position of tuple in index. Multikey and functional indexes are not supported. Also this patch extends method index_create_iterator_after and adds implementation of iterator_position for memtx tree. Options after and fetch_pos are added to Lua select as well (both FFI and LuaC). All the types of memtx tree indexes are supported (multikey, functional). NO_CHANGELOG=see later commits NO_DOC=see later commits Closes #7633 Closes #7636
-
- Sep 13, 2022
-
-
Georgy Moshkin authored
Before this change there was no way to create a fiber that accepts parameters without yielding from the current fiber using the c api. You could pass the function arguments when calling fiber_start, but that forces you to yield, which is not acceptable in some scenarios (e.g. within a transaction). This commit introduces 2 new functions to the api: fiber_set_ctx for setting an pointer to a context of the given fiber and fiber_get_ctx for accessing that context. Closes https://github.com/tarantool/tarantool/issues/7669 @TarantoolBot document Title: fiber: add fiber_set_ctx & fiber_get_ctx functions Add 2 api functions: `fiber_set_ctx` & `fiber_get_ctx` which can be used for passing data to a fiber. Previously this could be done via the `fiber_start` function, except that this would force the current fiber to yield, which is not acceptable in some scenarios (e.g. during a transaction). Now you can create a fiber with `fiber_new`, set it's contents with `fiber_set_ctx`, make it ready for execution with `fiber_wakeup` and keep executing the current fiber.
-
- Sep 12, 2022
-
-
Vladimir Davydov authored
strerror() is MT-Unsafe, because it uses a static buffer under the hood. We should use strerror_r() instead, which takes a user-provided buffer. The problem is there are two implementations of strerror_r(): XSI and GNU. The first one returns an error code and always writes the message to the beginning of the buffer while the second one returns a pointer to a location within the buffer where the message starts. Let's introduce a macro HAVE_STRERROR_R_GNU set if the GNU version is available and define tt_strerror() which writes the message to the static buffer, like tt_cstr() or tt_sprintf(). Note, we have to export tt_strerror(), because it is used by Lua via FFI. We also need to make it available in the module API header, because the say_syserror() macro uses strerror() directly. In order to avoid adding tt_strerror() to the module API, we introduce an internal helper function _say_strerror(), which calls tt_strerror(). NO_DOC=bug fix NO_TEST=code is covered by existing tests
-
- Aug 26, 2022
-
-
Mergen Imeev authored
This commit introduces a new parse rule for compiling an unresolved single expression. This simplifies the current implementation of sql_expr_compile() and is useful for generating SQL expressions that can be used in the core check constraint. This rule is for internal use only. Part of #6986 NO_DOC=will be added later NO_TEST=refactoring NO_CHANGELOG=will be added later
-
- Aug 05, 2022
-
-
Alexander Turenko authored
The Rust module (see the issue) needs a getter and a setter for decimal values on the Lua stack. Let's make them part of the module API. Part of #7228 @TarantoolBot document Title: Lua/C functions for decimals in the module API The following functions are added into the module API: ```c /** * Allocate a new decimal on the Lua stack and return * a pointer to it. */ API_EXPORT box_decimal_t * luaT_newdecimal(struct lua_State *L); /** * Allocate a new decimal on the Lua stack with copy of given * decimal and return a pointer to it. */ API_EXPORT box_decimal_t * luaT_pushdecimal(struct lua_State *L, const box_decimal_t *dec); /** * Check whether a value on the Lua stack is a decimal. * * Returns a pointer to the decimal on a successful check, * NULL otherwise. */ API_EXPORT box_decimal_t * luaT_isdecimal(struct lua_State *L, int index); ```
-
- Aug 04, 2022
-
-
Alexander Turenko authored
The main decision made in this patch is how large the public `box_decimal_t` type should be. Let's look on some calculations. We're interested in the following values. * How much decimal digits is stored? * Size of an internal decimal type (`sizeof(decimal_t)`). * Size of a buffer to store a string representation of any valid `decimat_t` value. * Largest signed integer type fully represented in decimal_t (number of bits). * Largest unsigned integer type fully represented in decimal_t (number of bits). Now `decimal_t` is defined to store 38 decimal digits. It means the following values: | digits | sizeof | string | int???_t | uint???_t | | ------ | ------ | ------ | -------- | --------- | | 38 | 36 | 52 | 126 | 127 | In fact, decNumber (the library we currently use under the hood) allows to vary the 'decimal digits per unit' parameter, which is 3 by default, so we can choose density of the representation. For example, for given 38 digits the sizeof is 36 by default, but it may vary from 28 to 47 bytes: | digits | sizeof | string | int???_t | uint???_t | | ------ | ---------- | ------ | -------- | --------- | | 38 | 36 (28-47) | 52 | 126 | 127 | If we'll want to store `int128_t` and `uint128_t` ranges, we'll need 39 digits: | digits | sizeof | string | int???_t | uint???_t | | ------ | ---------- | ------ | -------- | --------- | | 39 | 36 (29-48) | 53 | 130 | 129 | If we'll want to store `int256_t` and `uint256_t` ranges: | digits | sizeof | string | int???_t | uint???_t | | ------ | ---------- | ------ | -------- | --------- | | 78 | 62 (48-87) | 92 | 260 | 259 | If we'll want to store `int512_t` and `uint512_t` ranges: | digits | sizeof | string | int???_t | uint???_t | | ------ | ------------ | ------ | -------- | --------- | | 155 | 114 (84-164) | 169 | 515 | 514 | The decision here is what we consdider as possible and what as unlikely. The patch freeze the maximum amount of bytes in `decimal_t` as 64. So we'll able to store 256 bit integers and will NOT able to store 512 bit integers in a future (without the ABI breakage at least). The script, which helps to calculate those tables, is at end of the commit message. Next, how else `box_decimal_*()` library is different from the internal `decimal_*()`? * Added a structure that may hold any decimal value from any current or future tarantool version. * Added `box_decimal_copy()`. * Left `strtodec()` out of scope -- we can add it later. * Left `decimal_str()` out of scope -- it looks dangerous without at least a good explanation when data in the static buffer are invalidated. There is `box_decimal_to_string()` that writes to an explicitly provided buffer. * Added `box_decimal_mp_*()` for encoding to/decoding from msgpack. Unlike `mp_decimal.h` functions, here we always have `box_decimal_t` as the first parameter. * Left `decimal_pack()` out of scope, because a user unlikely wants to serialize a decimal value piece-by-piece. * Exposed `decimal_unpack()` as `box_decimal_mp_decode_data()` to keep a consistent terminogoly around msgpack encoding/decoding. * More detailed API description, grouping by functionality. The script, which helps to calculate sizes around `decimal_t`: ```lua -- See notes in decNumber.h. -- DECOPUN: DECimal Digits Per UNit local function unit_size(DECOPUN) assert(DECOPUN > 0 and DECOPUN < 10) if DECOPUN <= 2 then return 1 elseif DECOPUN <= 4 then return 2 end return 4 end function sizeof_decimal_t(digits, DECOPUN) -- int32_t digits; -- int32_t exponent; -- uint8_t bits; -- <..padding..> -- <..units..> local us = unit_size(DECOPUN) local padding = us - 1 local unit_count = math.ceil(digits / DECOPUN) return 4 + 4 + 1 + padding + us * unit_count end function string_buffer(digits) -- -9.{9...}E+999999999# (# is '\0') -- ^ ^ ^^^^^^^^^^^^ return digits + 14 end function binary_signed(digits) local x = 1 while math.log10(2 ^ (x - 1)) < digits do x = x + 1 end return x - 1 end function binary_unsigned(digits) local x = 1 while math.log10(2 ^ x) < digits do x = x + 1 end return x - 1 end function digits_for_binary_signed(x) return math.ceil(math.log10(2 ^ (x - 1))) end function digits_for_binary_unsigned(x) return math.ceil(math.log10(2 ^ x)) end function summary(digits) print('digits', digits) local sizeof_min = math.huge local sizeof_max = 0 local DECOPUN_sizeof_min local DECOPUN_sizeof_max for DECOPUN = 1, 9 do local sizeof = sizeof_decimal_t(digits, DECOPUN) print('sizeof', sizeof, 'DECOPUN', DECOPUN) if sizeof < sizeof_min then sizeof_min = sizeof DECOPUN_sizeof_min = DECOPUN end if sizeof > sizeof_max then sizeof_max = sizeof DECOPUN_sizeof_max = DECOPUN end end print('sizeof min', sizeof_min, 'DECOPUN', DECOPUN_sizeof_min) print('sizeof max', sizeof_max, 'DECOPUN', DECOPUN_sizeof_max) print('string', string_buffer(digits)) print('int???_t', binary_signed(digits)) print('uint???_t', binary_unsigned(digits)) end ``` Part of #7228 @TarantoolBot document Title: Module API for decimals See the declarations in `src/box/decimal.h` in tarantool sources.
-
- Aug 01, 2022
-
-
Alexander Turenko authored
The Rust module [1] leans on several internal symbols. They were open in Tarantool 2.8 (see #2971 and #5932), but never were in the public API. Tarantool 2.10.0 hides the symbols and we need a way to get them back to use in the module. We have the following options: 1. Design and expose a module API for fiber channels. 2. Export the symbols with a prefix like `tnt_internal_` (to don't spoil the global namespace). 3. Provide a `dlsym()` alike function to get an address of an internal symbol for users who knows what they're doing. I think that the third way offers the best compromise between amount of effort, quality of the result and opportunities to extend. In this commit I hardcoded the list of functions to make the change as safe as possible. Later I'll return here to autogenerate the list. Exported the following function from the tarantool executable: ```c void * tnt_internal_symbol(const char *name); ``` I don't add it into the module API headers, because the function is to perform a dark magic and we don't suggest it for users. While I'm here, added `static` to a couple of fiber channel functions, which are only used within the compilation unit. [1]: https://github.com/picodata/tarantool-module Part of #7228 Related to #6372 NO_DOC=don't advertize the dangerous API NO_CHANGELOG=don't advertize the dangerous API
-
- Jul 26, 2022
-
-
Alexander Turenko authored
Added a function (see the API in the documentation request below), which reflects the `tuple[json_path]` Lua API (see #1285). Part of #7228 @TarantoolBot document Title: tuple: access a field using JSON path via module API The following function is added into the module API: ```c /** * Return a raw tuple field in the MsgPack format pointed by * a JSON path. * * The JSON path includes the outmost field. For example, "c" in * ["a", ["b", "c"], "d"] can be accessed using "[2][2]" path (if * index_base is 1, as in Lua). If index_base is set to 0, the * same field will be pointed by the "[1][1]" path. * * The first JSON path token may be a field name if the tuple * has associated format with named fields. A field of a nested * map can be accessed in the same way: "foo.bar" or ".foo.bar". * * The return value is valid until the tuple is destroyed, see * box_tuple_ref(). * * Return NULL if the field does not exist or if the JSON path is * malformed or invalid. Multikey JSON path token [*] is treated * as invalid in this context. * * \param tuple a tuple * \param path a JSON path * \param path_len a length of @a path * \param index_base 0 if array element indexes in @a path are * zero-based (like in C) or 1 if they're one-based (like * in Lua) * \retval a pointer to a field data if the field exists or NULL */ API_EXPORT const char * box_tuple_field_by_path(box_tuple_t *tuple, const char *path, uint32_t path_len, int index_base); ```
-
- Jul 22, 2022
-
-
Yaroslav Lobankov authored
The packpack-dont-decline-custom-version.patch file was introduced in 9707a7bd (github-ci: support the new version format) and tried to resolve the issue that actually did not exist. PackPack supports accepting a custom version (pay attention to `?=`) [1] and the patch is not needed. [1] https://github.com/packpack/packpack/blob/194f898750cbbee6dd35255fe8aa7ec878eb3836/pack/config.mk#L45 NO_DOC=ci NO_TEST=ci NO_CHANGELOG=ci
-
- Jun 22, 2022
-
-
Mergen Imeev authored
This macro does nothing, so it is dropped. NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring
-
- May 22, 2022
-
-
Aleksandr Lyapunov authored
By a mistake it was marked as API_EXPORT but was forgotten to be added to exports. Closes #7125 NO_DOC=bugfix
-
- May 20, 2022
-
-
Timur Safin authored
Properly calculate `isdst` field in datetime Lua object and for attribute returned by `:totable()` function. NO_DOC=next commit
-
Maxim Kokryashkin authored
LuaJIT submodule is bumped to introduce the following changes: * sysprof: change C configuration API * sysprof: enrich symtab on a new trace or a proto * sysprof: fix SYSPROF_HANDLER_STACK_DEPTH * sysprof: make internal API functions static * sysprof: add LUAJIT_DISABLE_SYSPROF to Makefile * symtab: check the _GNU_SOURCE definition Within this changeset Tarantool-specific backtrace handler is introduced and set to be used by sysprof machinery. Besides, all new public Lua C API introduced within this changeset is added to extra/exports. Follows up #781 NO_DOC=LuaJIT submodule bump NO_TEST=LuaJIT submodule bump NO_CHANGELOG=LuaJIT submodule bump
-
Mergen Imeev authored
This patch introduces operator [] that allows to get elements from MAP and ARRAY values. Closes #4762 Closes #4763 Part of #6251 @TarantoolBot document Title: Operator [] in SQL Operator `[]` allows to get an element of MAP and ARRAY values. Examples: ``` tarantool> box.execute([[SELECT [1, 2, 3, 4, 5][3];]]) --- - metadata: - name: COLUMN_1 type: any rows: - [3] ... tarantool> box.execute([[SELECT {'a' : 123, 7: 'asd'}['a'];]]) --- - metadata: - name: COLUMN_1 type: any rows: - [123] ... ``` The returned values is of type ANY. If the operator is applied to a value that is not a MAP or ARRAY or is NULL, an error is thrown. Example: ``` tarantool> box.execute([[SELECT 1[1];]]) --- - null - Selecting is only possible from map and array values ... ``` However, if there are two or more operators next to each other, the second or following operators do not throw an error, but instead return NULL. Example: ``` tarantool> box.execute([[select [1][1][2][3][4];]]) --- - metadata: - name: COLUMN_1 type: any rows: - [null] ... ```
-
- May 11, 2022
-
-
Timur Safin authored
Since recently we partially support timezone names (i.e. as abbreviations) so we may modify tz attribute support for datetime constructors or :set() operations. Closes #7076 Relates to #7007 @TarantoolBot document Title: datetime tz attribute Now `tz` attribute is properly handled in datetime value constructors or `:set{}` method modifiers. ``` tarantool> T = date.new{year = 1980, tz = 'MSK'} --- ... tarantool> T.tzoffset --- - 180 ... tarantool> T.tz --- - MSK ... tarantool> T = date.new{year = 1980, tzoffset = 180} --- ... tarantool> T.tzindex --- - 0 ... tarantool> T.tz --- - ... tarantool> T.tzoffset --- - 180 ... tarantool> T:set{tz = 'MSK'} --- ... tarantool> T.tz --- - MSK ... ```
-
- Apr 29, 2022
-
-
Vladimir Davydov authored
Box read operations (select, min, max, random, pairs) may call a Lua function via Lua C API if space upgrade (EE feature) is in progress. This is forbidden if the original function was called via FFI: https://github.com/tarantool/luajit/commit/4f4fd9ebeb10d53c8e67f45170938f052818e64e Let's add helper functions to disable FFI for box read operations. We will use them in EE code. NO_DOC=internal NO_TEST=internal NO_CHANGELOG=internal
-
- Apr 28, 2022
-
-
Yaroslav Lobankov authored
Fix the following error: {"badRequest": {"message": "The requested availability zone is not available", "code": 400}} NO_DOC=testing stuff NO_TEST=testing stuff NO_CHANGELOG=testing stuff
-
- Apr 25, 2022
-
-
Maxim Kokryashkin authored
LuaJIT submodule is bumped to introduce the following changes: * GC64: disable sysprof support * build: make -DLUAJIT_DISABLE_SYSPROF work * test: disable sysprof C API tests with backtrace * tools: introduce parsers for sysprof * sysprof: introduce Lua API * memprof: add profile common section * core: introduce lua and platform profiler * memprof: move symtab to a separate module * core: separate the profiling timer from lj_profile * vm: save topframe info into global_State Within this changeset a parser for binary data dumped via the sampling profiler to Tarantool binary. It is a set of the following Lua modules: * sysprof/parse.lua: decode the sampling profiler event stream * sysprof/collapse.lua: collapse stacks obtained while profiling * sysprof.lua: Lua script and module to display data Besides, all new public Lua C API introduced within this changeset is added to extra/exports. Closes #781 NO_DOC=LuaJIT submodule bump NO_TEST=LuaJIT submodule bump
-
Mergen Imeev authored
This patch introduces basic INTERVAL support in SQL. After this patch, it will be allowed to select INTERVAL values from spaces, insert them into spaces, and use them in functions. CAST() from INTERVAL to STRING and ANY is also supported. Part of #6773 NO_DOC=Will be added later. NO_CHANGELOG=Will be added later.
-
- Apr 22, 2022
-
-
Mergen Imeev authored
Part of #6773 NO_DOC=INTERVAL has already been introduced earlier. NO_CHANGELOG=It will be added in another commit.
-
Timur Safin authored
Split single sec field in the datetime_interval into multiple subfields, i.e. week, day, hour, min, sec. Make sure that whatever we enter in the constructor we get similarly visualized as textual representation Lua implementation of datetime_totable has been converted to C, which allows to use it for datetime values decomposing in datetimes subtraction. It uses per component subtraction for calculating of a resultant interval. Part of #6923 NO_DOC=refactoring NO_CHANGELOG=refactoring
-
Timur Safin authored
Created C implementation for the rest of datetime/interval operations and call them via FFI. We need it for later Olson integration. Part of #6923 NO_DOC=refactoring NO_CHANGELOG=refactoring NO_TEST=refactoring, tests left intact
-
Timur Safin authored
Convert Lua implementation of datetime_increment_by to C from their Lua variant. Part of #6923 NO_DOC=refactoring NO_CHANGELOG=refactoring NO_TEST=refactoring, tests left intact
-
Timur Safin authored
Part of #6923 NO_DOC=refactoring NO_CHANGELOG=refactoring NO_TEST=refactoring, tests left intact
-
- Apr 13, 2022
-
-
Nikita Pettik authored
Simply add Lua wrappers for recently introduced prbuf. Introduce new buffer (in addition to ibuf) - prbuf. "pr" stands for "partitioned ring-". It save all metadata in the same memory chunk provided for storage, so it can be completely restored from the 'raw' memory. API: ``` -- mem is a chunk of raw (char *) memory, of size mem_size. -- It is used for data storage. Note that available space is of less -- size due to prbuf metadata overhead. -- Returns handle to prbuf. -- require('buffer').prbuf_create(mem, mem_size) -- mem is a chunk of memory, which contains already created prbuf. -- It implies that once prbuf_create() was called with the same memory. -- If mem does not contain valid buffer - raise an appropriate error. require('buffer').prbuf_open(mem) -- Returns continuous chunk of memory with given size. May return nil -- in case if requested chunk is too large. Note that after copying -- object to returned chunk, it should be committed with prbuf:commit(); -- otherwise :prepare() may return the same chunk twice. prbuf:prepare(size) -- Commits the last prepared chunk. Undefined behaviour in case of -- committing the same chunk twice. prbuf:commit() -- Create and return prbuf_iterator. Does not fail. Created iterator -- points to nowhere - it should be adjusted with :next() call to -- the first entry. prbuf:iterator_create() -- Advance iterator position. Returns prbuf_entry or nil in case -- iterator has reached the end. Entry consists of two members: -- size and ptr. The last one is an array of characters of given size. iterator:next() ``` Usage examples: ``` local ibuf = buffer.ibuf() local prbuf_size = 100 local memory = ibuf:alloc(prbuf_size) local prbuf = buffer.prbuf_create(memory, prbuf_size) local sample_size = 4 local raw = prbuf:prepare(4) if raw == nil then -- allocation size is too large, try smaller. end raw[0] = ... ... raw[3] = ... prbuf:commit() local prbuf_recovered = buffer.prbuf_open(memory) local iter = prbuf_recovered:iterator_create() local entry = iter:next() assert(tonumber(entry.size) == 4) -- Check values stored in the buffer. assert(entry.ptr[0] == ...) entry = iter:next() -- Our buffer has only one entry. assert(entry == nil) ``` NO_DOC=<Feature for internal usage> NO_CHANGELOG=<Feature for internal usage>
-
Pavel Balaev authored
Currently `tarantoolctl rocks --help` generate such help message: NAME /usr/bin/tarantoolctl - LuaRocks main command-line interface SYNOPSIS /usr/bin/tarantoolctl [<flags...>] [VAR=VALUE]... This is wrong. This patch makes the output look like this: NAME /usr/bin/tarantoolctl rocks - LuaRocks main command-line interface SYNOPSIS /usr/bin/tarantoolctl rocks [<flags...>] [VAR=VALUE]... NO_DOC=bugfix
-
- Apr 11, 2022
-
-
Andrey Saranchin authored
An opportunity to call garbage collector of memtx transaction manager manually allows to understand which garbage cannot be freed. This knowledge can help us to improve garbage collector. Also this opportunity makes it easier to test memtx mvcc memory monitoring. Part of #6150 NO_DOC=internal feature NO_CHANGELOG=internal feature NO_TEST=internal feature
-
- Apr 04, 2022
-
-
Aleksandr Lyapunov authored
Now memtx TX manager tries to determine the best isolation level by itself. There could be two options: * READ_COMMITTED, when the transaction see changes of other tx that are committed but not yet confirmed (written to WAL) * READ_CONFIRMED, when the transaction see only confirmed changes. Introduce a simple way to specify the isolation level explicitly: box.begin{tx_isolation = 'default'} - the same as box.begin(). box.begin{tx_isolation = 'read-committed'} - READ_COMMITTED. box.begin{tx_isolation = 'read-confirmed'} - READ_CONFIRMED. box.begin{tx_isolation = 'best-effort'} - old automatic way. Intrduce a bit more complex but potentially faster way to set isolation level, like that: my_level = box.tnx_isolation_level.READ_COMMITTED .. box.begin{tx_isolation = my_level} For simplicity of implementation also support symmetric values as 'READ_COMMITTED' and box.tnx_isolation_level['read-committed']. Introduce a new box.cfg option - default_tx_isolation, that is used as a default when a transaction is started. The option is dynamic and possible values are the same as in box.begin, except 'default' which is meaningless. In addition to string value the corresponding numeric values can be used in both box.begin and box.cfg. Part of #6930 NO_DOC=see later commits NO_CHANGELOG=see later commits
-
Timur Safin authored
* Default parse - new c-dt version used which handles extended years range while parse relaxed iso8601 gformat strings; - family of functions like dt_from_ymd_checked functions added to the new c-dt version, now used by conversion code to properly handle validation of a 32-bit boundary values; - datetime_parse_full() modified to properly handle huge years values; - added tests for extended years range. * strptime-like parse - properly handle longer than 4 years values, negative values, and handle zulu suffix, which may be generated by Tarantool stringization routines; Part of #6731 NO_DOC=internal NO_CHANGELOG=internal
-
Timur Safin authored
To parse date/time strings using format string we use `strptime()` implementation from FreeBSD, which is modified to use our `struct datetime` data structure. List of supported format has been extended to include `%f` which is flag used whenever you need to process nanoseconds part of datetime value. ``` tarantool> T = date.parse('Thu Jan 1 03:00:00 1970', {format = '%c'}) tarantool> T - 1970-01-01T03:00:00Z tarantool> T = date.parse('12/31/2020', {format = '%m/%d/%y'}) tarantool> T - 2020-12-31T00:00:00Z tarantool> T = date.parse('1970-01-01T03:00:00.125000000+0300', {format = '%FT%T.%f%z'}) tarantool> T - 1970-01-01T03:00:00.125+0300 ``` Part of #6731 NO_DOC=internal NO_CHANGELOG=internal
-
Timur Safin authored
Datetime module provides parse function to create datetime object given input string. `datetime.parse` function expect 1 required argument - which is input string, and set of optional parameters passed as table in 2nd argument. Allowed attributes in this optional table are: * `format` - should be either 'iso8601', 'rfc3339' or `strptime`-like format string. [strptime format will be added as part of next commit]; * `tzoffset` - to redefine offset of input string value, if there is no timezone provided. * `tz` - human-readable, Olson database, timezone identifier, e.g. 'Europe/Moscow'. Not yet implemented in this commit. ``` tarantool> T = date.parse('1970-01-01T00:00:00Z') tarantool> T - 1970-01-01T00:00:00Z tarantool> T = date.parse('1970-01-01T00:00:00', {format = 'iso8601', tzoffset = 180}) tarantool> T - 1970-01-01T00:00:00+0300 tarantool> T = date.parse('2017-12-27T18:45:32.999999-05:00', {format = 'rfc3339'}) tarantool> T - 2017-12-27T18:45:32.999999-0500 ``` Implemented as per RFC https://hackmd.io/@Mons/S1Vfc_axK#%D0%AD%D1%82%D0%B0%D0%BF-3-%D0%9F%D0%B0%D1%80%D1%81%D0%B8%D0%BD%D0%B3-%D0%B4%D0%B0%D1%82-%D0%BF%D0%BE-%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D1%83 Part of #6731 NO_DOC=internal NO_CHANGELOG=internal
-
- Mar 14, 2022
-
-
Mergen Imeev authored
This patch introduces basic DATETIME support in SQL. After this patch, it will be allowed to select DATETIME values from spaces, insert them into spaces, and use them in functions. CAST() from DATETIME to STRING, SCALAR and ANY is also supported. Part of #6773 NO_DOC=Doc-request will be added in another commit. NO_CHANGELOG=Changelog will be added in another commit.
-
- Dec 20, 2021
-
-
Timur Safin authored
Serialize `struct datetime` as newly introduced MP_EXT type. It saves 1 required integer field and 3 optional fields: - epoch is required field; - but nsec, tzoffset and tzindex are optional; * supported json, yaml serialization formats, lua output mode; Please refer to the https://hackmd.io/@Mons/S1Vfc_axK#%D0%A3%D0%BF%D0%B0%D0%BA%D0%BE%D0%B2%D0%BA%D0%B0-%D0%B2-msgpack for a description of a messagepack serialization schema for datetime values. Follow-up to #5941 Part of #5946
-
Timur Safin authored
Add interval arithmetics as date:add{} and date:sub{}, or overloaded '+' and '-' operators (__add/_sub metamethods). There is no special processing for timezone specific daylight saving time changes, which impacts result of arithmetics. This will be completed after Olsen database support added. If one needs to control a way arithmetic proceeded for days of months then there is optional argument to `:add()` or `:sub()`, which defines how we round day in month after arithmetic operation: - 'last' - mode when day snaps to the end of month, if happens: -- 29.02.2004 -> 31.03.2004 dt:add{month = 1, adjust = "last" } - 'none' only truncation toward the end of month performed (**default mode**): -- 29.02.* -> 29.03.* dt:add{month = 1, adjust = "none" } - 'excess' - overflow mode, without any snap or truncation to the end of month, straight addition of days in month, stopping over month boundaries if there is less number of days. dt = new{year = 2004, month = 1, day = 31} dt:add{month = 1, adjust = 'excess'} -> 02.03.2004 -- i.e. there were 29 days in February 2004, 2 excessive days from original date 31 make result 2nd March 2004 Intervals objects, created via `datetime.interval.new()` call and objects of the same attributes are equivalent for interval arithmetics and exchangeable. i.e. dt + date.interval.new{year = 1, month = 2} is the same as dt + {year = 1, month = 2} Follow-up to #5941
-
- Dec 17, 2021
-
-
Vladimir Davydov authored
Currently, we use the same luarocks hardcoded config for static build as for regular build. As a result, LUA_BINDIR, LUA_INCDIR, SYSCONFDIR, and PREFIX point to locations inside the build directory, which doesn't make any sense. Let's introduce a special hardcoded config which will set those directories to locations relative to the binary location: - LUA_BINDIR: directory where the binary is located (bindir) - PREFIX: <dir> if bindir is <dir>/bin, otherwise bindir. - LUA_INCDIR: PREFIX/include/tarantool - SYSCONFDIR: PREFIX/etc/tarantool/rocks Also, let's add the PREFIX/rocks to the rocks path if present. This is needed for Tarantool SDK bundle to work as expected. In particular the check for <dir>/bin is needed, because SDK installs binaries in bundle root, not in /bin.
-
Vladimir Davydov authored
The options are not used anymore since update to 3.1.1, see third_party/luarocks/src/luarocks/core/cfg.lua. They should have been removed by commit 4222c1f6 ("rocks: update luarocks to 3.1.1")
-
Vladimir Davydov authored
It contains Lua code. Format it appropriately. No functional changes.
-
- Dec 13, 2021
-
-
mechanik20051988 authored
Previously, URI can be passed as a string, which contains one URI or several URIs separated by commas. Now URIs can be passed in different ways: as before, as a table which contains URI and it's parameters in "param" table, as a table which contains URI strings and URI tables. Also there are different ways to specify properties for URI: in a string which contains URI, after '?' delimiter, in a table which contains URI in "params" table, in "default_params" table if it is default parameters for all URIs. For this purposes new method `parse_many` was implemented in tarantool `uri` library. Also `parse` method was updated to make possible the same as new `parse_many` method but only for single URI. ```lua uri = require('uri') -- Single URI, passed as before uri.parse_many("/tmp/unix.sock") -- Single URI, with query paramters uri.parse_many("/tmp/unix.sock?q1=v1&q2=v2") -- Several URIs with parameters in one string, separated by commas uri.parse_many("/tmp/unix.sock_1?q=v, /tmp/unix.sock_2?q=v") -- Single URI passed in table, with additional parameters, passed -- in "params" table. This parameters overwrite parameters from -- URI string (q1 = "v2" in example below). uri.parse_many({"/tmp/unix.sock?q1=v1", params = {q1 = "v2"}}) -- For parse it's also works now uri.parse({"/tmp/unix.sock?q1=v1", params = {q1 = "v2"}}) -- Several URIs passed in table with default parameters, passed -- in "default_params" table, which are used for parameters, which -- not specified for URI (q3 parameter with "v3" value corresponds -- to all URIs, and used if there is no such parameter in URI). uri.parse_many({ "/tmp/unix.sock_1?q1=v1", { uri = "/tmp/unix.sock_2", params = { q2 = "v2" } }, default_params = { q3 = "v3" } }) ```
-
mechanik20051988 authored
Implement ability to parse a string, which contains several URIs separated by commas. Each URI can contain different query parameters after '?'. All created URIs saved in new implemented struct `uri_set`. Part of #5928
-