Created
July 26, 2016 13:09
-
-
Save bigbes/089854ba4788a7a47e96cbe07ca5d2d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/box/alter.cc b/src/box/alter.cc | |
index e209f16..1326551 100644 | |
--- a/src/box/alter.cc | |
+++ b/src/box/alter.cc | |
@@ -1388,7 +1388,7 @@ on_replace_dd_index(struct trigger * /* trigger */, void *event) | |
auto lock_guard = make_scoped_guard([&]{ latch_unlock(&schema_lock); }); | |
struct txn *txn = (struct txn *) event; | |
- txn_check_autocommit(txn, "Space _index"); | |
+ /* txn_check_autocommit(txn, "Space _index"); */ | |
struct txn_stmt *stmt = txn_current_stmt(txn); | |
struct tuple *old_tuple = stmt->old_tuple; | |
struct tuple *new_tuple = stmt->new_tuple; | |
diff --git a/src/box/box.cc b/src/box/box.cc | |
index a311d6e..12adbf1 100644 | |
--- a/src/box/box.cc | |
+++ b/src/box/box.cc | |
@@ -717,6 +717,7 @@ space_truncate(struct space *space) | |
key_buf_end = mp_encode_uint(key_buf, space_id(space)); | |
assert(key_buf_end <= key_buf + sizeof(key_buf)); | |
+ txn_check_autocommit(txn, "Space _index"); | |
/* BOX_INDEX_ID is id of _index space, we need 0 index of that space */ | |
struct space *space_index = space_cache_find(BOX_INDEX_ID); | |
Index *index = index_find(space_index, 0); | |
@@ -740,6 +741,7 @@ space_truncate(struct space *space) | |
} | |
assert(index_count <= BOX_INDEX_MAX); | |
+ box_txn_begin(); | |
/* drop all selected indexes */ | |
for (int i = index_count - 1; i >= 0; --i) { | |
uint32_t index_id = tuple_field_u32(indexes[i], 1); | |
@@ -747,8 +749,10 @@ space_truncate(struct space *space) | |
key_buf_end = mp_encode_uint(key_buf_end, space_id(space)); | |
key_buf_end = mp_encode_uint(key_buf_end, index_id); | |
assert(key_buf_end <= key_buf + sizeof(key_buf)); | |
- if (box_delete(BOX_INDEX_ID, 0, key_buf, key_buf_end, NULL)) | |
+ if (box_delete(BOX_INDEX_ID, 0, key_buf, key_buf_end, NULL)) { | |
+ box_txn_rollback(); | |
diag_raise(); | |
+ } | |
} | |
/* create all indexes again, now they are empty */ | |
@@ -756,9 +760,11 @@ space_truncate(struct space *space) | |
tuple = indexes[i]; | |
if (box_insert(BOX_INDEX_ID, tuple->data, | |
tuple->data + tuple->bsize, NULL)) { | |
+ box_txn_rollback(); | |
diag_raise(); | |
} | |
} | |
+ box_txn_commit(); | |
} | |
int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment