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