Skip to content

Commit

Permalink
memtx: check for ephemeral spaces in a uniform way
Browse files Browse the repository at this point in the history
In our SQL implementation temporary spaces are used. They come to
MVCC engine in two variants - NULL or ephemeral. In both cases
MVCC engine must not do anything, there are several checks for
that in different parts of code.

Normalize these checks and make them similar to each other.

Part of tarantool#8648
Part of tarantool#8654

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring
  • Loading branch information
alyapunov committed May 17, 2023
1 parent ffda510 commit 4a4d88c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
14 changes: 3 additions & 11 deletions src/box/memtx_tx.c
Expand Up @@ -2025,7 +2025,7 @@ memtx_tx_history_add_stmt(struct txn_stmt *stmt, struct tuple *old_tuple,
struct tuple **result)
{
assert(stmt != NULL);
assert(stmt->space != NULL);
assert(stmt->space != NULL && !stmt->space->def->opts.is_ephemeral);
assert(new_tuple != NULL || old_tuple != NULL);
assert(new_tuple == NULL || !tuple_has_flag(new_tuple, TUPLE_IS_DIRTY));

Expand Down Expand Up @@ -2666,11 +2666,7 @@ static void
memtx_tx_track_read_story(struct txn *txn, struct space *space,
struct memtx_story *story, uint64_t index_mask)
{
if (txn == NULL)
return;
if (space == NULL)
return;
if (space->def->opts.is_ephemeral)
if (txn == NULL || space == NULL || space->def->opts.is_ephemeral)
return;
(void)space;
assert(story != NULL);
Expand Down Expand Up @@ -2715,11 +2711,7 @@ memtx_tx_track_read(struct txn *txn, struct space *space, struct tuple *tuple)
{
if (tuple == NULL)
return;
if (txn == NULL)
return;
if (space == NULL)
return;
if (space->def->opts.is_ephemeral)
if (txn == NULL || space == NULL || space->def->opts.is_ephemeral)
return;

if (tuple_has_flag(tuple, TUPLE_IS_DIRTY)) {
Expand Down
15 changes: 3 additions & 12 deletions src/box/memtx_tx.h
Expand Up @@ -282,10 +282,7 @@ memtx_tx_track_point(struct txn *txn, struct space *space,
{
if (!memtx_tx_manager_use_mvcc_engine)
return;
if (txn == NULL)
return;
/* Skip ephemeral spaces. */
if (space == NULL || space->def->id == 0)
if (txn == NULL || space == NULL || space->def->opts.is_ephemeral)
return;
memtx_tx_track_point_slow(txn, index, key);
}
Expand Down Expand Up @@ -315,10 +312,7 @@ memtx_tx_track_gap(struct txn *txn, struct space *space, struct index *index,
{
if (!memtx_tx_manager_use_mvcc_engine)
return;
if (txn == NULL)
return;
/* Skip ephemeral spaces. */
if (space == NULL || space->def->id == 0)
if (txn == NULL || space == NULL || space->def->opts.is_ephemeral)
return;
memtx_tx_track_gap_slow(txn, space, index, successor,
type, key, part_count);
Expand Down Expand Up @@ -346,10 +340,7 @@ memtx_tx_track_full_scan(struct txn *txn, struct space *space,
{
if (!memtx_tx_manager_use_mvcc_engine)
return;
if (txn == NULL)
return;
/* Skip ephemeral spaces. */
if (space == NULL || space->def->id == 0)
if (txn == NULL || space == NULL || space->def->opts.is_ephemeral)
return;
memtx_tx_track_full_scan_slow(txn, index);
}
Expand Down

0 comments on commit 4a4d88c

Please sign in to comment.