From: Aleksandr Lyapunov <alyapunov@tarantool.org> To: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH 03/15] tx: introduce dirty tuples Date: Fri, 3 Jul 2020 09:33:05 +0300 [thread overview] Message-ID: <1593757997-4145-4-git-send-email-alyapunov@tarantool.org> (raw) In-Reply-To: <1593757997-4145-1-git-send-email-alyapunov@tarantool.org> --- src/box/memtx_engine.c | 4 ++-- src/box/tuple.c | 4 ++-- src/box/tuple.h | 8 +++++++- src/box/tuple_format.c | 4 ++-- src/box/vy_stmt.c | 4 ++-- test/box/huge_field_map.result | 2 +- test/box/huge_field_map_long.result | 2 +- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c index b5b6b14..af80d9e 100644 --- a/src/box/memtx_engine.c +++ b/src/box/memtx_engine.c @@ -1131,8 +1131,8 @@ memtx_tuple_new(struct tuple_format *format, const char *data, const char *end) * tuple is not the first field of the memtx_tuple. */ uint32_t data_offset = sizeof(struct tuple) + field_map_size; - if (data_offset > UINT16_MAX) { - /** tuple->data_offset is 16 bits */ + if (data_offset > INT16_MAX) { + /** tuple->data_offset is 15 bits */ diag_set(ClientError, ER_TUPLE_METADATA_IS_TOO_BIG, data_offset); goto end; diff --git a/src/box/tuple.c b/src/box/tuple.c index e48ee08..c599b30 100644 --- a/src/box/tuple.c +++ b/src/box/tuple.c @@ -84,8 +84,8 @@ runtime_tuple_new(struct tuple_format *format, const char *data, const char *end goto end; uint32_t field_map_size = field_map_build_size(&builder); uint32_t data_offset = sizeof(struct tuple) + field_map_size; - if (data_offset > UINT16_MAX) { - /** tuple->data_offset is 16 bits */ + if (data_offset > INT16_MAX) { + /** tuple->data_offset is 15 bits */ diag_set(ClientError, ER_TUPLE_METADATA_IS_TOO_BIG, data_offset); goto end; diff --git a/src/box/tuple.h b/src/box/tuple.h index 9a88772..b647161 100644 --- a/src/box/tuple.h +++ b/src/box/tuple.h @@ -319,7 +319,13 @@ struct PACKED tuple /** * Offset to the MessagePack from the begin of the tuple. */ - uint16_t data_offset; + uint16_t data_offset : 15; + /** + * The tuple (if it's found in index for example) could be invisible + * for current transactions. The flag means that the tuple must + * be clarified by transaction engine. + */ + bool is_dirty : 1; /** * Engine specific fields and offsets array concatenated * with MessagePack fields array. diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c index 68ec2a7..6ebc855 100644 --- a/src/box/tuple_format.c +++ b/src/box/tuple_format.c @@ -481,8 +481,8 @@ tuple_format_create(struct tuple_format *format, struct key_def * const *keys, assert(tuple_format_field(format, 0)->offset_slot == TUPLE_OFFSET_SLOT_NIL); size_t field_map_size = -current_slot * sizeof(uint32_t); - if (field_map_size > UINT16_MAX) { - /** tuple->data_offset is 16 bits */ + if (field_map_size > INT16_MAX) { + /** tuple->data_offset is 15 bits */ diag_set(ClientError, ER_INDEX_FIELD_COUNT_LIMIT, -current_slot); return -1; diff --git a/src/box/vy_stmt.c b/src/box/vy_stmt.c index f59c418..837be8c 100644 --- a/src/box/vy_stmt.c +++ b/src/box/vy_stmt.c @@ -160,8 +160,8 @@ vy_stmt_alloc(struct tuple_format *format, uint32_t data_offset, uint32_t bsize) { assert(data_offset >= sizeof(struct vy_stmt) + format->field_map_size); - if (data_offset > UINT16_MAX) { - /** tuple->data_offset is 16 bits */ + if (data_offset > INT16_MAX) { + /** tuple->data_offset is 15 bits */ diag_set(ClientError, ER_TUPLE_METADATA_IS_TOO_BIG, data_offset); return NULL; diff --git a/test/box/huge_field_map.result b/test/box/huge_field_map.result index 11b4da3..45022cc 100644 --- a/test/box/huge_field_map.result +++ b/test/box/huge_field_map.result @@ -38,7 +38,7 @@ test_run:cmd("setopt delimiter ''"); pcall(test) -- must fail but not crash | --- | - false - | - 'Can''t create tuple: metadata size 65558 is too big' + | - 'Can''t create tuple: metadata size 32790 is too big' | ... test = nil diff --git a/test/box/huge_field_map_long.result b/test/box/huge_field_map_long.result index d7971ae..cb47900 100644 --- a/test/box/huge_field_map_long.result +++ b/test/box/huge_field_map_long.result @@ -40,7 +40,7 @@ test_run:cmd("setopt delimiter ''"); pcall(test) -- must fail but not crash | --- | - false - | - 'Can''t create tuple: metadata size 65542 is too big' + | - 'Can''t create tuple: metadata size 32774 is too big' | ... test = nil -- 2.7.4
next prev parent reply other threads:[~2020-07-03 6:33 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-03 6:33 [Tarantool-patches] [PATCH 00/15] Transaction engine for memtx engine Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 01/15] Update license file (2020) Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 02/15] Check data_offset overflow in struct tuple Aleksandr Lyapunov 2020-07-05 17:03 ` Vladislav Shpilevoy 2020-07-06 13:39 ` Aleksandr Lyapunov 2020-07-03 6:33 ` Aleksandr Lyapunov [this message] 2020-07-05 17:04 ` [Tarantool-patches] [PATCH 03/15] tx: introduce dirty tuples Vladislav Shpilevoy 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 04/15] vinyl: rename tx_manager -> vy_tx_manager Aleksandr Lyapunov 2020-07-05 17:04 ` Vladislav Shpilevoy 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 05/15] tx: save txn in txn_stmt Aleksandr Lyapunov 2020-07-05 17:04 ` Vladislav Shpilevoy 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 06/15] tx: add TX status Aleksandr Lyapunov 2020-07-05 17:04 ` Vladislav Shpilevoy 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 07/15] tx: save preserve old tuple flag in txn_stmt Aleksandr Lyapunov 2020-07-05 17:05 ` Vladislav Shpilevoy 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 08/15] tx: introduce tx manager Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 09/15] tx: introduce prepare sequence number Aleksandr Lyapunov 2020-07-05 17:05 ` Vladislav Shpilevoy 2020-07-06 13:50 ` Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 10/15] tx: introduce txn_stmt_destroy Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 11/15] tx: introduce conflict tracker Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 12/15] tx: introduce txm_story Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 13/15] tx: indexes Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 14/15] tx: introduce point conflict tracker Aleksandr Lyapunov 2020-07-03 6:33 ` [Tarantool-patches] [PATCH 15/15] tx: use new tx managet in memtx Aleksandr Lyapunov 2020-07-05 17:03 ` [Tarantool-patches] [PATCH 00/15] Transaction engine for memtx engine Vladislav Shpilevoy 2020-07-06 13:29 ` Aleksandr Lyapunov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1593757997-4145-4-git-send-email-alyapunov@tarantool.org \ --to=alyapunov@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 03/15] tx: introduce dirty tuples' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox