- Jun 08, 2020
-
-
Vladislav Shpilevoy authored
Region is used for temporary allocations, usually bound to a transaction, but not always. Keyword - temporary. It is usually much faster to allocate something on the region than on the heap, and much much faster to free the region, since it frees data in whole slabs. Lots of objects at once. Region is used both for byte arrays (MessagePack, strings, blobs), and for objects like standard types, structs. Almost always for allocations was used region_alloc() function, which returns a not aligned address. It can be anything, even not multiple of 2. That led to alignment violation for standard types and structs. Usually it is harmless in terms of errors, but can be slower than aligned access, and on some platforms may even crash. Also the crash can be forced using clang undefined behaviour sanitizer, which revealed all the not aligned accesses fixed in this patch. Part of #4609
-
Vladislav Shpilevoy authored
Vdbe at runtime allocates VdbeCursor structure using allocateCursor() function. Inside there is a pointer at BtCursor structure. To make the allocation faster and improve cache locality, both cursors are allocated in one memory block + some extra memory for uint32_t array, where BtCursor followed VdbeCursor and the array without any padding: VdbeCursor + uint32_t * N + BtCursor The problem is that BtCursor needs 8 byte alignment. When it followed VdbeCursor (aligned by 8) + some uint32_t values, its actual alignment could become 4 bytes. That led to a crash when alignment sanitizer is enabled in clang. The patch makes BtCursor offset aligned by 8 bytes. Part of #4609
-
Vladislav Shpilevoy authored
There is some assembly working with a byte array like with an array of unsigned long values. That is incorrect, because the byte array may be not aligned by 'unsigned long'. The patch makes crc32 calculate the hash on the prefix byte-by-byte, then word-by-word on aligned addresses, and again byte-by-byte on a tail which is less than word. Assuming that the word-by-word part is the longest, this should reduce number of memory/cache loads in ~x2 times. Because in case of a not aligned word load it was necessary to load 2 words, and then merge them into one. When addresses are aligned, this is only 1 load. Part of #4609
-
Vladislav Shpilevoy authored
Clang has a built-in sanitizer for undefined behaviour. Such as wrong memory alignment, array boundaries violation, 0 division, bool values with non standard content, etc. The sanitizer emits runtime checks which lead to either crash, or a trap, or a warning print, depending on what is chosen. The patch makes it possible to turn the sanitizer on and catch UBs. The only supported UB so far is alignment check. Other types can be added gradually, along with fixing bugs which they find. The UB sanitizer is activated for ASAN builds in CI. Part of #4609
-
Vladislav Shpilevoy authored
Warning about invalid offsetof() (used on non-POD types) was set for g++, but wasn't for clang++. Warning about invalid alignof() (when expression is passed to it instead of a type) wasn't ignored, but is going to be very useful in upcoming unaligned memory access patches. That allows to write something like: struct some_long_type *object = region_aligned_alloc( region, size, alignof(*object)); This will work even if type of 'object' will change in future, and so it is safer. And shorter. Part of #4609
-
Vladislav Shpilevoy authored
Rlist used a hack to implement offsetof() leading to crash under undefined behaviour clang sanitizer. It was fixed in this update. Additionally, region_alloc_object() is changed to return the used size and a new macro region_alloc_array() is added. This small API change is supposed to simplify switching lots of region allocations to aligned versions in scope of #4609. And finally - there was a bug in lsregion, when allocation was exactly of slab size. It is fixed in small's master. Part of #4609
-
Serge Petrenko authored
GCC 10 produces the following error: cc1: warning: function may return address of local variable [-Wreturn-local-addr] Fix it. Part-of #4966
-
Cyrill Gorcunov authored
Add tests for setting up logging via log module. Part-of #689 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
In the patch we introduce an ability to configure logging engine early without calling box.cfg{} at all. For this sake we have to modify the load_cfg.lua (main cfg loader) together with log.lua built in module. In particular the configuration entries which are supposed to be handled by modules are grouped in module_cfg table, where we list box.cfg{} keys and methods to fetch/set the values. Same time the template_cfg{} starts to carry 'module' keyword telling prepare_cfg routine to use modules. @TarantoolBot documnent Title: Module log To configure log module eary without initializing box module at all call the `log.cfg({})` method, where the following arguments are acceptable: - `log` to specify file, pipe or syslog (same as `box.cfg{log}` option); the default value is nil and stderr is used; - `level` to specify logging level; can be numbers (1-7) or strings (fatal,syserror,error,crit,warn,info,verbose,debug); the default value is 5 (i.e. 'info'); While for symbolic representations of levels we allow only predefined keywords to be used, to keep backward compatibility the numbers can be any; - `format` to specify output encoding ('plain' or 'json'); the default value is 'plain'; - `nonblock` to open logging output in nonblocking mode (`true` or `false`); the default value is `false`. Fixes #689 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
- Jun 04, 2020
-
-
Sergey Bronnikov authored
In upgrade testing we need an ability to control running of upgrade.lua script execution. When constant ERRINJ_AUTO_UPGRADE is set to true tarantool will skip upgrade.lua script execution. Part of #4801
-
- Jun 03, 2020
-
-
Alexander V. Tikhonov authored
During investigation of the issues found that error message had not user friendly format: local pwgr_errstr = "get%s failed [errno %d]: %s" produced: [001] LuajitError: builtin/pwd.lua:101: getgetgrall failed [errno 2]: No such file or directory while it had to be: [001] LuajitError: builtin/pwd.lua:101: getgrall failed [errno 2]: No such file or directory Fixed the error message.
-
Alexander V. Tikhonov authored
During creating patch: e3d9d8c9 ("build: add CentOS 8 into CI / CD") was found the issue: [001] app-tap/pwd.test.lua [ fail ] [001] Test failed! Output from reject file app-tap/pwd.reject: [001] TAP version 13 [001] 1..6 [001] ok - checking user by id [001] ok - checking user by name [001] ok - checking group by id [001] ok - checking group by name [001] [001] Last 15 lines of Tarantool Log file [Instance "app_server"][/mnt/test/var/001_app-tap/pwd.test.lua.tarantool.log]: [001] tarantool: /lib64/libcurl.so.4: no version information available (required by tarantool) [001] builtin/pwd.lua:169: getpwall failed [errno 2]: No such file or directory Currently it was tried to reproduce the issue, but all the attempts didn't got the needed fail. After discussion of the issue decided to close the current one as not the issue for the test and continue the fixes for getpwall/getgrall functions within issue #5034. Closes #4592
-
Cyrill Gorcunov authored
For some reason we've missed that say_set_log_format doesn't support json format not only for syslog but for boottime logging as well. Part-of #689 Reviewed-by:
Oleg Babin <olegrok@tarantool.org> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
This allows us to reuse them instead of copying opencoded constants. They are highly bound to ones compiled into the C code. Part-of #689 Reviewed-by:
Oleg Babin <olegrok@tarantool.org> Reviewed-by:
Leonid Vasiliev <lvasiliev@tarantool.org> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
We gonna use it to provide a way to initialize logger subsystem early. Part-of #689 Reviewed-by:
Oleg Babin <olegrok@tarantool.org> Reviewed-by:
Leonid Vasiliev <lvasiliev@tarantool.org> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
To eliminate opencoded comparision. Reviewed-by:
Leonid Vasiliev <lvasiliev@tarantool.org> Reviewed-by:
Oleg Babin <olegrok@tarantool.org> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
We gonna support logger configuration on its own without requirement to call `box.cfg{}`. Thus lets say_logger_init() to skip processing if we already did. Note it is preparatory for next patches. Currently the init called once. Part-of #689 Reviewed-by:
Oleg Babin <olegrok@tarantool.org> Reviewed-by:
Leonid Vasiliev <lvasiliev@tarantool.org> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
- Jun 02, 2020
-
-
Leonid Vasiliev authored
The tcp server starts in a separate fiber. When server's socket is closed from another fiber, an exception will be thrown in server's loop from check_socket function. A "socket is close" check has been added at server's fiber and now server's fiber terminates correctly. Fixes: #4087
-
Leonid Vasiliev authored
For the CustomError the ability to create a message using a format string was added. Closes #4903 @TarantoolBot document Title: Add format string usage to compose a CustomError message When an error created using the separate members mode (box.error(code, errtext[, errtext ...])) in the case of ClientError error creation, a pre-defined format is used (corresponding to the error code) (nothing has changed), in the case of CustomError error creation, a format string can be used to compose a message. ClientError(nothing has changed): ```Lua box.error(code, reason args) ``` Example for ER_CREATE_SPACE: ```Lua box.error(9, "my_space", "reason") ``` Result: ```Lua error: 'Failed to create space ''my_space'': reason' ``` CustomError: ```Lua box.error(type, reason format string, reason args) ``` Example: ```Lua box.error("MyCustomType", "The error reason: %s", "some error reason") ``` Result: ```Lua error: 'The error reason: some error reason' ```
-
- Jun 01, 2020
-
-
Kirill Yukhin authored
Make it possible to set temporary directory where module will be copied before load. @TarantoolBot document Title: Justify module (re-)loading semantics It is now possible to set directory where temporary copies of modules to be loaded will be created. It is done by setting $(TMPDIR) variable. It will be "/tmp" if variable was not set. Follow up #4945
-
Kirill Yukhin authored
Tarantool module reload mechanism allows to reload a module even if there're functions running. It is implemented by refcounting each invocation of module's routines. If reload is called, then refcounter is checked: - If it is 0, then no routines are in flight and module is reloaded by simple pair of dlclose()/dlopen(). - If it is non-zero, then there're routines in flight. To allow to load multiple versions of modules it is loaded not from the DSO specified. Symlink to tempdir is created and dlopen() is invoked against it (w/RTLD_LOCAL flag to avoid conflicts). This trick was implemented in order to fool a dynamic linker: one cannot invoke dlopen() against same file, so let's pretend there're to independent DSOs. The problem is that dynamic linker is smart enough. It tracks not filenames, but i-nodes. Moreover it is smart enough to do stat -L against DSO to follow symlinks! [1][2] So, any attempts to create a symlinks to fool dynamic linker fail and instead of doing actual load it just increments internal refcounter in map w/ corresponding inode, which in turn leads to not-reloading. This wasn't caught by test since old module was always unlinked before new one is copied in place. The patch always copies DSO instead of creating a symlink. Also it fixes the test so in SEGFAULTs without the change. Closes #4945 [1] - https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-load\ .c;h=a5318f9c8d1d42745a254479cf6bb1cd2acd516f;hb=58557c229319a3b8d\ 2eefdb62e7df95089eabe37#l898 [2] - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/pos\ ix/dl-fileid.h;hb=58557c229319a3b8d2eefdb62e7df95089eabe37#l33
-
- May 29, 2020
-
-
Alexander V. Tikhonov authored
OSX testing completely implemented on local MAC hosts with OSX 14 and 15 versions. So no more need to test and support issues with testing OSX with 14 version on travis-ci. Part of #4893
-
- May 28, 2020
-
-
Vladislav Shpilevoy authored
Test modules are shared libraries. They link with Tarantool at runtime and resolve missing symbols then. However in case they already contain some of the same symbols used by tarantool, that leads to a conflict in ASAN build. Nothing serious, there are strict rules how a linker should behave in this case, but there is still a warning. This is how it looked (the text is shortened): ==25624==ERROR: AddressSanitizer: odr-violation (0x000001123b60): [1] size=1024 'mp_type_hint' /builds/nZUxDh2c/0/tarantool/tarantool/src/lib/msgpuck/hints.c:39:20 [2] size=1024 'mp_type_hint' /builds/nZUxDh2c/0/tarantool/tarantool/src/lib/msgpuck/hints.c:39:20 These globals were registered at these points: [1]: #0 0x478b8e in __asan_register_globals (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0x478b8e) #1 0x7ff7a9bc9d0b in asan.module_ctor (/tmp/tntz2FLhA/function1.so+0x6d0b) [2]: #0 0x478b8e in __asan_register_globals (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0x478b8e) #1 0xab990b in asan.module_ctor (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0xab990b) The symbol mp_type_hint is defined both in tarantool executable, and in function1.so dynamic library. This is because both build with msgpuck static library. However the modules don't need to be built with msgpuck. They can link with it at runtime from tarantool executable. This patch removes msgpuck from test dynamic modules, and exports all msgpuck non-inlined symbols explicitly, so they couldn't be removed by the linker in future. Follow-up #2971 Follow-up #5001 Closes #5023
-
Oleg Piskunov authored
- Adding 2 servers (sh1, sh2) for performance testing. - Rebalance performance testing between servers: - sh1 (tag: docker_sh1_perf) used for benches: nosqlbench_hash, nosqlbench_tree - sh2 (tag: docker_sh2_perf) used for benches: ycsb_hash, ycsb_tree, cbench - sh3 (tag: docker_sh3_perf) used for benches: sysbench, tpcc - sh9 (tag: docker_perf_ssd) used for benches: linkbench_ssd - Changing gitlab-ci tag for performance docker images from 'perf' to 'deploy'. Closes #4868
-
Oleg Piskunov authored
Each temporary docker perf image is about 5 GB and we don’t have space to keep them localy on servers. - add cleanup after perf docker image preparation (perf_bootstrap job). - cleanup perf docker images on execution hosts after perf testing (cleanup stage). Closes #5003
-
Alexander V. Tikhonov authored
Set hard-coded unix sockets for iproto connections at core = app. Added its option in *-tap/suites.ini files and fixed test for it. Fix helped to handle the problem with 'Address already in use' error. Check the previous commit that set the use of sockets: 60f84cbf ('test: use unix sockets for iproto connections') Test sql-tap/gh-4077-iproto-execute-no-bind.test.lua removed from fragiled list. Closes #4459
-
Vladislav Shpilevoy authored
The function returns a number of bytes needed to store an fk_constraint_def object with its name and links. However it used sizeof(struct fk_constraint) instead of sizeof(struct fk_constraint_def) to calculate base object size. This worked only because fk_constraint is bigger than fk_constraint_def.
-
Cyrill Gorcunov authored
Part-of #689 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
Cyrill Gorcunov authored
The implementation has been removed in commit ef2c171d Part-of #689 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com>
-
- May 27, 2020
-
-
Vladislav Shpilevoy authored
Vclock depends on bit library, but wasn't linked to it.
-
Nikita Pettik authored
Before this patch box.snapshot() bails out immediately if it sees that the scheduler is throttled due to errors. For instance: box.error.injection.set('ERRINJ_VY_RUN_WRITE', true) snapshot() -- fails due to ERRINJ_VY_RUN_WRITE box.error.injection.set('ERRINJ_VY_RUN_WRITE', false) snapshot() -- still fails despite the fact that injected error is unset As a result, one has to wait up to a minute to make a snapshot. The reason why throttling was introduced was to avoid flooding the log in case of repeating disk errors. What is more, to deal with schedule throttling in tests, we had to introduce a new error injection (ERRINJ_VY_SCHED_TIMEOUT). It reduces time duration during which the scheduler remains throttled, which is ugly and race prone. So, let's unthrottle scheduler when checkpoint process is launched via manual box.snapshot() invocation. Closes #3519
-
Nikita Pettik authored
In some cases it may turn out to be useful to know whether checkpoint process was launched manually (explicitly calling box.snapshot()) or automatically via checkpoint daemon. In particular, to unthrottle vinyl scheduler when it comes for manual checkpoints. So let's extend engine's vtab method begin_checkpoint() with corresponding argument. Needed for #3519
-
Nikita Pettik authored
Assert in vy_tx_write() validates that upsert applied on the top of cached statement is always replace. In fact, it is not always so. If vy_apply_upsert() fails due to the fact that PK is modified, it returns old statement (i.e. statement which upsert is applied on). In this regard, if tuple cache contains insert and invalid upsert is executed, vy_apply_upsert() will return insert. As a result, assert will fire. Let's fix it and take into account that vy_apply_upsert() is able to return inserts as well. Closes #5005
-
- May 25, 2020
-
-
Vladislav Shpilevoy authored
vinyl_engine_create_space() didn't set an error in the diagnostics area when region_alloc() failed. This could lead to a crash, although was almost impossible to happen.
-
Vladislav Shpilevoy authored
There were lots of errors of kind: /builds/M4RrgQZ3/0/tarantool/tarantool/src/exports.h:395:1: error: variable ‘uuid_nil’ redeclared as function EXPORT(uuid_nil) ^ /builds/M4RrgQZ3/0/tarantool/tarantool/src/lib/uuid/tt_uuid.c:39:22: note: previously declared here const struct tt_uuid uuid_nil; when LTO was enabled. That happened because exports.c file, to take symbol addresses, declared lots of functions and variables from all the code base as extern void <symbol>(void); This is crazy, but it worked for normal builds. Because symbol is symbol. The compilers couldn't find conflicting declarations, because they never met in one compilation unit. However the lie was revealed by linker with LTO enabled. It could see, that actual symbol definitions didn't match their exports in exports.c. It could live with mismatching function-function or variable-variable cases, but couldn't withstand function-variable mismatches. When a symbol was declared as a variable in one place and as a function in another. This was the case for variables: - uuid_nil - tarantool_lua_ibuf - log_pid - log_format - crc32_calc - _say - log_level The errors were false positive, because the symbols were never used for anything except taking their addresses. To calm the linker down exports.c now does not participate in LTO. Closes #5001
-
- May 22, 2020
-
-
Sergey Bronnikov authored
Due to inaccuracy FreeBSD skip conditions were overwritten by OpenBSD skip conditions. Closes #5004
-
- May 21, 2020
-
-
Vladislav Shpilevoy authored
Functions tt_uuid_is_nil() and tt_uuid_is_equal() used struct tt_uuid as an array of two uint64. But it is wrong, because struct tt_uuid has 4 byte alignment, while uint64 requires 8. That led to unaligned memory access in these 2 functions. The patch makes these functions use memcmp() - it appers to be faster (disassembly shows much smaller code and without jumps), and does not depend on alignment. Part of #4609 Reviewed-by:
Aleksandr Lyapunov <alyapunov@tarantool.org> Reviewed-by:
Timur Safin <tsafin@tarantool.org>
-
Vladislav Shpilevoy authored
Lib/bit library in some functions dereferenced a byte array as a pointer at uint64 or uint32. It led to unaligned memory access, when the array didn't have the needed alignment. That made clang 'alignment' sanitizer crazy. Also there were places, where bitwise shift was done for the type size. For example, a uint32 number was allowed to make 32 bit shift in both sides. This is undefined behaviour. The patch fixes these UBs. Bitwise shift of too long size is banned. Unaligned access is fixed in some places by changing uint64 to uint8, when it is possible without perf loss. And in the others by using explicitly specified unaligned load. So it works the same, but the sanitizer is aware of that. Part of #4609 Reviewed-by:
Aleksandr Lyapunov <alyapunov@tarantool.org> Reviewed-by:
Timur Safin <tsafin@tarantool.org>
-
Vladislav Shpilevoy authored
Msgpuck functions mp_snprint() and mp_fprint() now support customizable MP_EXT serializer. This patch makes them able to correctly serialize all tarantool's MP_EXT extensions: MP_DECIMAL, MP_UUID, MP_ERROR. Closes #4719 Reviewed-by:
Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by:
Serge Petrenko <sergepetrenko@tarantool.org> Reviewed-by:
Nikita Pettik <korablev@tarantool.org> Reviewed-by:
Alexander Turenko <alexander.turenko@tarantool.org>
-
Vladislav Shpilevoy authored
Msgpuck functions mp_snprint() and mp_fprint() now support customizable MP_EXT serializer. This patch adds such for MP_ERROR. All extension serializers will be activated in a separate commit. Part of #4719 Reviewed-by:
Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by:
Serge Petrenko <sergepetrenko@tarantool.org> Reviewed-by:
Nikita Pettik <korablev@tarantool.org> Reviewed-by:
Alexander Turenko <alexander.turenko@tarantool.org>
-