-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Проблема с crud.count #418
Comments
Обезличенная схема проблемы: crud.count('table', {
{'>=', 'date_from', 24},
{'<=', 'date_to', 60},
{'=', 'test_field', ‘test’},
})
crud.count('table', {
{'=', 'test_field', ‘test’},
{'>=', 'date_from', 24},
{'<=', 'date_to', 60},
})
crud.count('table', {
{'=', 'test_field', ‘test’},
{'=', 'date_from', 24},
{'=', 'date_to', 60},
})
Так как реальные данные и их схема потенциально являются конфиденциальными сведениями, реальные запросы не приводятся. |
На данный момент по предоставленным данным не вышло воспроизвести проблему, были запрошены дополнительные сведения. |
Удалось вопроизвести проблему, в блиажйшее время будет исправление |
DifferentialOrange
added a commit
that referenced
this issue
Feb 2, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, the following tuples will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is broken, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - at least two of them operands with index, - non-scanning index condition uses `<=`, `<`,`>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 2, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. The erroneous behavior reported by [1] and #418 is as follows: - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, the following tuples will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is broken, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - at least two of them operands with index, - non-scanning index condition uses `<=`, `<`,`>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 2, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. The erroneous behavior reported by [1] and #418 is as follows: - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, the following tuples will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is broken, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - at least two of them operands with index, - non-scanning index condition uses `<=`, `<`,`>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 5, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. The erroneous behavior reported by [1] and #418 is as follows: - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, all tuples after this one will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is violated, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - there are at least two different index operands, - non-scanning index condition uses `<=`, `<`, `>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 5, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. The erroneous behavior reported by [1] and #418 is as follows: - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, all tuples after this one will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is violated, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - there are at least two different index operands, - non-scanning index condition uses `<=`, `<`, `>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 5, 2024
The issue described below is related to the read operations which allows to scan: `crud.select`, `crud.pairs`, `crud.count`, `readview:select` and `readview:pairs`. The erroneous behavior reported by [1] and #418 is as follows: - result changes when reordering operation conditions; - when `>=` condition operation is changed to `=`, there are more rows in the result. The reason is as follows. Scanning read operates with two entities: an iterator and a filter. The iterator includes an index, a starting value and iterator type (EQ, GT, etc.). The iterator is built from conditions, if possible, otherwise primary index is used. Remaining conditions form the filter, so the actual result satisfies all operation conditions. The filter supports early exit. Let's consider the following example. For `crud.select(space, {{'>=', 'id', 1}, {'<=', 'id', 10}})`, where `id` is an index (or an indexed field), the iterator uses index `id`, starts from key = `1` and goes by GE rules, covering [1, +inf) ordered keys. On the other hand, when iterator reaches the tuple with `id` = `11`, all tuples after this one will never satisfy the second condition, because our iterator yields tuples sorted by `id` (due to underlying index). So filter tells than there is no reason to scan anymore, and we finish the scanning procedure. Before this patch, the function behind early exit decision had worked as follows: "if the condition is an index, we go in forward (reverse) order and `<=` or `<` (`>=` or `>`) condition is violated, there is no reason to scan anymore". But the valid approach is "if the condition is SCANNING index...". Before this patch, filter had assumed that if the condition for index is specified, tuples are ordered, but it works only if iterator uses the same index as in the condition. This patch fixes the issue. The erroneous behavior may happen in the following case: - there are multiple conditions, - there are at least two different index operands, - non-scanning index condition uses `<=`, `<`, `>=` or `>` operation. 1. https://jira.vk.team/browse/TNT-941 Closes #418
DifferentialOrange
added a commit
that referenced
this issue
Feb 5, 2024
Overview This release introduces compatibility with several Tarantool 3 + vshard 0.1.25 features, as well as critical scan fix. Fixed * Compatibility with vshard configuration if UUIDs are omitted (#407). * Compatibility with automatic master discovery in vshard (#409). * Secondary conditions for index operands with operations `>=`, `<=`, `>`, `<` no longer cause missing part of the actual result for scan operations (`crud.select`, `crud.pairs`, `crud.count`, `readview:select`, `readview:pairs`) (#418).
Merged
DifferentialOrange
added a commit
that referenced
this issue
Feb 5, 2024
Overview This release introduces compatibility with several Tarantool 3 + vshard 0.1.25 features, as well as critical scan fix. Fixed * Compatibility with vshard configuration if UUIDs are omitted (#407). * Compatibility with automatic master discovery in vshard (#409). * Secondary conditions for index operands with operations `>=`, `<=`, `>`, `<` no longer cause missing part of the actual result for scan operations (`crud.select`, `crud.pairs`, `crud.count`, `readview:select`, `readview:pairs`) (#418).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Делали запрос crud.count с такими-то параметрами (на видео, которое они скидывали, есть настоящий пример). При перестановке условий получается разный результат, хотя этого не ожидалось. При замене условий с >= на = результат второго запроса больше результата первого, хотя этого тоже не ожидалось.
В принципе, то, чего они не ожидали, действительно не должно быть
В условиях здорового кластера
The text was updated successfully, but these errors were encountered: