Skip to content
Snippets Groups Projects
Commit 3f698116 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Tests for space_replace 2

parent deb90355
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ bool errinj_get(int id); ...@@ -53,6 +53,7 @@ bool errinj_get(int id);
void errinj_set(int id, bool state); void errinj_set(int id, bool state);
int errinj_set_byname(char *name, bool state); int errinj_set_byname(char *name, bool state);
struct tbuf;
void errinj_info(struct tbuf *out); void errinj_info(struct tbuf *out);
#ifdef NDEBUG #ifdef NDEBUG
......
...@@ -500,7 +500,7 @@ int32_tuple_to_node(struct tuple *tuple, struct key_def *key_def) ...@@ -500,7 +500,7 @@ int32_tuple_to_node(struct tuple *tuple, struct key_def *key_def)
if (k != mh_end(int_hash)) if (k != mh_end(int_hash))
ret = mh_i32ptr_node(int_hash, k)->val; ret = mh_i32ptr_node(int_hash, k)->val;
#ifdef DEBUG #ifdef DEBUG
say_debug("Hash32Index find(self:%p, key:%i) = %p", self, num, ret); say_debug("Hash32Index find(self:%p, key:%i) = %p", self, node.key, ret);
#endif #endif
return ret; return ret;
} }
...@@ -521,7 +521,7 @@ int32_tuple_to_node(struct tuple *tuple, struct key_def *key_def) ...@@ -521,7 +521,7 @@ int32_tuple_to_node(struct tuple *tuple, struct key_def *key_def)
ERROR_INJECT(ERRINJ_INDEX_ALLOC, ERROR_INJECT(ERRINJ_INDEX_ALLOC,
{ {
mh_i32ptr_del(int_hash, pos, NULL, NULL); mh_i32ptr_del(int_hash, pos, NULL, NULL);
pos = mh_end(int_hash); pos = mh_end(int_hash);
}); });
if (pos == mh_end(int_hash)) { if (pos == mh_end(int_hash)) {
...@@ -662,7 +662,7 @@ int64_tuple_to_node(struct tuple *tuple, struct key_def *key_def) ...@@ -662,7 +662,7 @@ int64_tuple_to_node(struct tuple *tuple, struct key_def *key_def)
if (k != mh_end(int64_hash)) if (k != mh_end(int64_hash))
ret = mh_i64ptr_node(int64_hash, k)->val; ret = mh_i64ptr_node(int64_hash, k)->val;
#ifdef DEBUG #ifdef DEBUG
say_debug("Hash64Index find(self:%p, key:%"PRIu64") = %p", self, num, ret); say_debug("Hash64Index find(self:%p, key:%"PRIu64") = %p", self, node.key, ret);
#endif #endif
return ret; return ret;
} }
...@@ -683,7 +683,7 @@ int64_tuple_to_node(struct tuple *tuple, struct key_def *key_def) ...@@ -683,7 +683,7 @@ int64_tuple_to_node(struct tuple *tuple, struct key_def *key_def)
ERROR_INJECT(ERRINJ_INDEX_ALLOC, ERROR_INJECT(ERRINJ_INDEX_ALLOC,
{ {
mh_i64ptr_del(int64_hash, pos, NULL, NULL); mh_i64ptr_del(int64_hash, pos, NULL, NULL);
pos = mh_end(int64_hash); pos = mh_end(int64_hash);
}); });
if (pos == mh_end(int64_hash)) { if (pos == mh_end(int64_hash)) {
tnt_raise(LoggedError, :ER_MEMORY_ISSUE, (ssize_t) pos, tnt_raise(LoggedError, :ER_MEMORY_ISSUE, (ssize_t) pos,
...@@ -840,7 +840,7 @@ lstrptr_tuple_to_node(struct tuple *tuple, struct key_def *key_def) ...@@ -840,7 +840,7 @@ lstrptr_tuple_to_node(struct tuple *tuple, struct key_def *key_def)
ERROR_INJECT(ERRINJ_INDEX_ALLOC, ERROR_INJECT(ERRINJ_INDEX_ALLOC,
{ {
mh_lstrptr_del(str_hash, pos, NULL, NULL); mh_lstrptr_del(str_hash, pos, NULL, NULL);
pos = mh_end(str_hash); pos = mh_end(str_hash);
}); });
if (pos == mh_end(str_hash)) { if (pos == mh_end(str_hash)) {
......
...@@ -420,6 +420,9 @@ lua box.space[11]:truncate() ...@@ -420,6 +420,9 @@ lua box.space[11]:truncate()
lua box.space[12]:truncate() lua box.space[12]:truncate()
--- ---
... ...
lua box.space[21]:truncate()
---
...
insert into t21 values (0, 0, 0, 0) insert into t21 values (0, 0, 0, 0)
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t21 values (1, 1, 1, 1) insert into t21 values (1, 1, 1, 1)
......
...@@ -270,6 +270,8 @@ exec admin "lua box.space[12]:truncate()" ...@@ -270,6 +270,8 @@ exec admin "lua box.space[12]:truncate()"
# hash::replace tests # hash::replace tests
# #
exec admin "lua box.space[21]:truncate()"
exec sql "insert into t21 values (0, 0, 0, 0)" exec sql "insert into t21 values (0, 0, 0, 0)"
exec sql "insert into t21 values (1, 1, 1, 1)" exec sql "insert into t21 values (1, 1, 1, 1)"
exec sql "insert into t21 values (2, 2, 2, 2)" exec sql "insert into t21 values (2, 2, 2, 2)"
...@@ -343,13 +345,4 @@ exec sql "select * from t21 WHERE k2 = 10" ...@@ -343,13 +345,4 @@ exec sql "select * from t21 WHERE k2 = 10"
exec sql "select * from t21 WHERE k3 = 10" exec sql "select * from t21 WHERE k3 = 10"
exec sql "select * from t21 WHERE k3 = 0" exec sql "select * from t21 WHERE k3 = 0"
# alloc test
#exec admin "set injection ERRINJ_INDEX_ALLOC on"
#exec sql "insert into t21 values (10, 10, 10, 10)"
#exec sql "select * from t21 WHERE k0 = 10"
#exec sql "select * from t21 WHERE k1 = 10"
#exec sql "select * from t21 WHERE k2 = 10"
#exec sql "select * from t21 WHERE k3 = 10"
#exec admin "set injection ERRINJ_INDEX_ALLOC off"
exec admin "lua box.space[21]:truncate()" exec admin "lua box.space[21]:truncate()"
...@@ -5,3 +5,4 @@ config = tarantool.cfg ...@@ -5,3 +5,4 @@ config = tarantool.cfg
# disabled = lua.test # disabled = lua.test
# put disabled in valgrind test here # put disabled in valgrind test here
#valgrind_disabled = ... #valgrind_disabled = ...
release_disabled = hash_errinj.test
...@@ -129,6 +129,9 @@ lua box.space[15].index[0]:select_range(3, 'abcdb') ...@@ -129,6 +129,9 @@ lua box.space[15].index[0]:select_range(3, 'abcdb')
lua box.space[15]:truncate() lua box.space[15]:truncate()
--- ---
... ...
lua box.space[22]:truncate()
---
...
insert into t22 values (0, 0, 0, 0) insert into t22 values (0, 0, 0, 0)
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t22 values (1, 1, 1, 1) insert into t22 values (1, 1, 1, 1)
...@@ -269,28 +272,6 @@ Found 3 tuples: ...@@ -269,28 +272,6 @@ Found 3 tuples:
[0, 0, 0, 0] [0, 0, 0, 0]
[4, 4, 0, 4] [4, 4, 0, 4]
[6, 6, 0, 6] [6, 6, 0, 6]
set injection ERRINJ_INDEX_ALLOC on
---
ok
...
insert into t22 values (10, 10, 10, 10)
Insert OK, 1 row affected
select * from t22 WHERE k0 = 10
Found 1 tuple:
[10, 10, 10, 10]
select * from t22 WHERE k1 = 10
Found 1 tuple:
[10, 10, 10, 10]
select * from t22 WHERE k2 = 10
Found 1 tuple:
[10, 10, 10, 10]
select * from t22 WHERE k3 = 10
Found 1 tuple:
[10, 10, 10, 10]
set injection ERRINJ_INDEX_ALLOC off
---
ok
...
lua box.space[22]:truncate() lua box.space[22]:truncate()
--- ---
... ...
...@@ -84,6 +84,8 @@ exec admin "lua box.space[15]:truncate()" ...@@ -84,6 +84,8 @@ exec admin "lua box.space[15]:truncate()"
# tree::replace tests # tree::replace tests
# #
exec admin "lua box.space[22]:truncate()"
exec sql "insert into t22 values (0, 0, 0, 0)" exec sql "insert into t22 values (0, 0, 0, 0)"
exec sql "insert into t22 values (1, 1, 1, 1)" exec sql "insert into t22 values (1, 1, 1, 1)"
exec sql "insert into t22 values (2, 2, 2, 2)" exec sql "insert into t22 values (2, 2, 2, 2)"
...@@ -166,14 +168,5 @@ exec sql "select * from t22 WHERE k2 = 0" ...@@ -166,14 +168,5 @@ exec sql "select * from t22 WHERE k2 = 0"
exec sql "delete from t22 WHERE k0 = 5" exec sql "delete from t22 WHERE k0 = 5"
exec sql "select * from t22 WHERE k2 = 0" exec sql "select * from t22 WHERE k2 = 0"
# tree alloc test
exec admin "set injection ERRINJ_INDEX_ALLOC on"
exec sql "insert into t22 values (10, 10, 10, 10)"
exec sql "select * from t22 WHERE k0 = 10"
exec sql "select * from t22 WHERE k1 = 10"
exec sql "select * from t22 WHERE k2 = 10"
exec sql "select * from t22 WHERE k3 = 10"
exec admin "set injection ERRINJ_INDEX_ALLOC off"
exec admin "lua box.space[22]:truncate()" exec admin "lua box.space[22]:truncate()"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment