diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c index d1242202defb0bcd1624edbc72edd8b50c9fca9c..c6b094794634547bfc4f53b9ac58e61d3a1dde7d 100644 --- a/src/box/memtx_space.c +++ b/src/box/memtx_space.c @@ -275,7 +275,7 @@ memtx_space_replace_all_keys(struct space *space, struct tuple *old_tuple, * Don't use MVCC engine for ephemeral in any case. * MVCC engine requires txn to be present as a storage for * reads/writes/conflicts. - * Also now there's not way to MVCC engine off: once MVCC engine + * Also, now there's no way to turn MVCC engine off: once MVCC engine * starts to manage a space - direct access to it must be prohibited. * Since modification of ephemeral spaces are allowed without txn, * we must not use MVCC for those spaces even if txn is present now. diff --git a/src/box/memtx_tree.cc b/src/box/memtx_tree.cc index b7e23af1b581a7579a06cf06b245219fe8ca9b8d..4dc86ddfde87efff5362d339176e99d2c8f78d52 100644 --- a/src/box/memtx_tree.cc +++ b/src/box/memtx_tree.cc @@ -709,14 +709,14 @@ tree_iterator_start_raw(struct iterator *iterator, struct tuple **ret) struct tuple *successor = res == NULL ? NULL : res->tuple; if (iterator_type_is_reverse(type)) { /* - * Because of limitations of tree search API we use use - * lower_bound for LT search and upper_bound for LE - * and REQ searches. Thus we found position to the + * Because of limitations of tree search API we use + * lower_bound for LT search and upper_bound for LE and + * REQ searches. In both cases we find a position to the * right of the target one. Let's make a step to the * left to reach target position. * If we found an invalid iterator all the elements in * the tree are less (less or equal) to the key, and - * iterator_next call will convert the iterator to the + * iterator_prev call will convert the iterator to the * last position in the tree, that's what we need. */ memtx_tree_iterator_prev(tree, &it->tree_iterator); diff --git a/src/box/memtx_tx.c b/src/box/memtx_tx.c index 1e1bb0746b7980c3ef809ba909e144bbd2243905..bb2252f013403c4658ccf138a32a1280a86cbcf9 100644 --- a/src/box/memtx_tx.c +++ b/src/box/memtx_tx.c @@ -500,7 +500,7 @@ memtx_tx_statistics_collect(struct memtx_tx_statistics *stats) } int -memtx_tx_register_tx(struct txn *tx) +memtx_tx_register_txn(struct txn *tx) { int size = 0; tx->memtx_tx_alloc_stats = @@ -958,7 +958,7 @@ memtx_tx_story_link(struct memtx_story *story, } /** - * Unlink a @a story with @ old_story in @a index (in both directions). + * Unlink a @a story with @a old_story in @a index (in both directions). * Older story is allowed to be NULL. */ static void @@ -1673,12 +1673,12 @@ point_hole_storage_find(struct index *index, struct tuple *tuple) /** * Check for possible conflicts during inserting @a new tuple, and given - * that it was real insertion, not the replacement of existion tuple. + * that it was real insertion, not the replacement of existing tuple. * It's the moment where we can search for stored point hole trackers * and detect conflicts. - * Since the insertions in not completed succesfully, we better store + * Since the insertions are not completed successfully, we better store * conflicts to the special temporary storage @a collected_conflicts in - * other to become real conflint only when insertion success is inevitable. + * other to become real conflict only when insertion success is inevitable. */ static int check_hole(struct space *space, uint32_t index, @@ -3034,7 +3034,7 @@ point_hole_storage_delete(struct point_hole_item *object) /** * Record in TX manager that a transaction @a txn have read a nothing - * from @a space and @ a index with @ key. + * from @a space and @a index with @a key. * The key is expected to be full, that is has part count equal to part * count in unique cmp_key of the index. * @return 0 on success, -1 on memory error. @@ -3094,10 +3094,10 @@ memtx_tx_gap_item_new(struct txn *txn, enum iterator_type type, /** * Record in TX manager that a transaction @a txn have read nothing - * from @a space and @ a index with @ key, somewhere from interval between + * from @a space and @a index with @a key, somewhere from interval between * some unknown predecessor and @a successor. * This function must be used for ordered indexes, such as TREE, for queries - * when interation type is not EQ or when the key is not full (otherwise + * when iteration type is not EQ or when the key is not full (otherwise * it's faster to use memtx_tx_track_point). * * @return 0 on success, -1 on memory error. @@ -3161,9 +3161,9 @@ memtx_tx_full_scan_item_new(struct txn *txn) } /** - * Record in TX manager that a transaction @a txn have read full @ a index. + * Record in TX manager that a transaction @a txn have read full @a index. * This function must be used for unordered indexes, such as HASH, for queries - * when interation type is ALL. + * when iteration type is ALL. * * @return 0 on success, -1 on memory error. */ diff --git a/src/box/memtx_tx.h b/src/box/memtx_tx.h index 2be3b04b0d1f5d8afb1ef9d728104bb938273435..f4ee22785df0bd908c820a6733bc4f653ce033a7 100644 --- a/src/box/memtx_tx.h +++ b/src/box/memtx_tx.h @@ -42,7 +42,7 @@ extern "C" { /** * Global flag that enables mvcc engine. - * If set, memtx starts to apply statements through txm history mechanism + * If set, memtx starts to apply statements through txn history mechanism * and tx manager itself transaction reads in order to detect conflicts. */ extern bool memtx_tx_manager_use_mvcc_engine; @@ -235,7 +235,7 @@ struct memtx_tx_snapshot_cleaner { * Cell of stats with total and count statistics. */ struct memtx_tx_stats { - /* Total over all measurements. */ + /* Total memory over all objects. */ size_t total; /* Number of measured objects. */ size_t count; @@ -255,11 +255,18 @@ struct memtx_tx_statistics { size_t txn_count; }; +/** + * Collect MVCC memory usage statics. + */ void memtx_tx_statistics_collect(struct memtx_tx_statistics *stats); +/** + * Initialize MVCC part of a transaction. + * Must be called even if MVCC engine is not enabled in config. + */ int -memtx_tx_register_tx(struct txn *tx); +memtx_tx_register_txn(struct txn *txn); /** * Initialize memtx transaction manager. @@ -419,7 +426,7 @@ memtx_tx_track_point_slow(struct txn *txn, struct index *index, /** * Record in TX manager that a transaction @a txn have read a nothing - * from @a space and @ a index with @ key. + * from @a space and @a index with @a key. * The key is expected to be full, that is has part count equal to part * count in unique cmp_key of the index. * @@ -451,10 +458,10 @@ memtx_tx_track_gap_slow(struct txn *txn, struct space *space, struct index *inde /** * Record in TX manager that a transaction @a txn have read nothing - * from @a space and @ a index with @ key, somewhere from interval between + * from @a space and @a index with @a key, somewhere from interval between * some unknown predecessor and @a successor. * This function must be used for ordered indexes, such as TREE, for queries - * when interation type is not EQ or when the key is not full (otherwise + * when iteration type is not EQ or when the key is not full (otherwise * it's faster to use memtx_tx_track_point). * * NB: can trigger story garbage collection. @@ -484,10 +491,10 @@ int memtx_tx_track_full_scan_slow(struct txn *txn, struct index *index); /** - * Record in TX manager that a transaction @a txn have read full @ a index + * Record in TX manager that a transaction @a txn have read full @a index * from @a space. * This function must be used for unordered indexes, such as HASH, for queries - * when interation type is ALL. + * when iteration type is ALL. * * NB: can trigger story garbage collection. * @@ -562,7 +569,7 @@ memtx_tx_index_invisible_count(struct txn *txn, } /** - * Clean memtx_tx part of @a txm. + * Clean memtx_tx part of @a txn. * * NB: can trigger story garbage collection. */ diff --git a/src/box/txn.c b/src/box/txn.c index 14e8ab580112c2fe9e8108e3093094df392dd1d4..b99df867d85a2f31c7ca5fcdd8c070fc9c90e855 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -554,12 +554,12 @@ txn_begin(void) trigger_create(&txn->fiber_on_stop, txn_on_stop, NULL, NULL); trigger_add(&fiber()->on_stop, &txn->fiber_on_stop); /* - * By default all transactions may yield. + * By default, all transactions may yield. * It's a responsibility of an engine to disable yields * if they are not supported. */ txn_set_flags(txn, TXN_CAN_YIELD); - int rc = memtx_tx_register_tx(txn); + int rc = memtx_tx_register_txn(txn); if (rc == -1) { txn_free(txn); return NULL;