vinyl: sanitize full/empty key stmt detection
Historically, we use tuple_field_count to check whether a statement represents an empty key (match all) or a full key (point lookup): if the number of fields in a tuple is greater than or equal to the number of parts in a key definition, it can be used as a full key; if the number of fields is zero, then the statement represents an empty key. While this used to be correct not so long ago, appearance of JSON indexes changed the rules of the game: now a tuple can have nested indexed fields so that the same field number appears in the key definition multiple times. This means tuple_field_count can be less than the number of key parts and hence the full key check won't work for a statement representing a tuple. Actually, any tuple in vinyl can be used as a full key as it has all key parts by definition, there's no need to use tuple_field_count for such statements - we only need to do that for statements representing keys. Keeping that in mind, let's introduce helpers for checking whether a statement can be used as a full/empty key and use them throughout the code.
Showing
- src/box/vinyl.c 1 addition, 1 deletionsrc/box/vinyl.c
- src/box/vy_cache.c 9 additions, 5 deletionssrc/box/vy_cache.c
- src/box/vy_mem.c 1 addition, 1 deletionsrc/box/vy_mem.c
- src/box/vy_point_lookup.c 2 additions, 3 deletionssrc/box/vy_point_lookup.c
- src/box/vy_range.c 2 additions, 3 deletionssrc/box/vy_range.c
- src/box/vy_read_iterator.c 3 additions, 3 deletionssrc/box/vy_read_iterator.c
- src/box/vy_read_set.c 6 additions, 12 deletionssrc/box/vy_read_set.c
- src/box/vy_run.c 1 addition, 1 deletionsrc/box/vy_run.c
- src/box/vy_stmt.h 38 additions, 0 deletionssrc/box/vy_stmt.h
- src/box/vy_tx.c 2 additions, 2 deletionssrc/box/vy_tx.c
Loading
Please register or sign in to comment