From 77d3d262c5e7d784204a6d91b79ed2f46b4013ad Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 18 Oct 2018 11:29:06 +0200 Subject: erts: Do contention adaptions during (updating) iterations Once an iteration key has been found, never fall back to first/last key in next/prev tree as trees may split or join under our feet. I.e we must always use previous key when searching for the next key. --- erts/emulator/beam/erl_db_catree.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'erts/emulator/beam/erl_db_catree.h') diff --git a/erts/emulator/beam/erl_db_catree.h b/erts/emulator/beam/erl_db_catree.h index feb6f27980..6913609bf8 100644 --- a/erts/emulator/beam/erl_db_catree.h +++ b/erts/emulator/beam/erl_db_catree.h @@ -95,8 +95,11 @@ typedef struct db_table_catree { typedef struct { DbTableCATree* tb; Eterm next_route_key; - DbTableCATreeBaseNode* locked_bnode; + DbTableCATreeNode* locked_bnode; + DbTableCATreeNode* bnode_parent; + int bnode_level; int read_only; + DbRouteKey* search_key; } CATreeRootIterator; @@ -109,9 +112,9 @@ TreeDbTerm** catree_find_root(Eterm key, CATreeRootIterator*); TreeDbTerm** catree_find_next_from_pb_key_root(Eterm key, CATreeRootIterator*); TreeDbTerm** catree_find_prev_from_pb_key_root(Eterm key, CATreeRootIterator*); -TreeDbTerm** catree_find_nextprev_root(CATreeRootIterator*, int next); -TreeDbTerm** catree_find_next_root(CATreeRootIterator*); -TreeDbTerm** catree_find_prev_root(CATreeRootIterator*); +TreeDbTerm** catree_find_nextprev_root(CATreeRootIterator*, int next, Eterm* keyp); +TreeDbTerm** catree_find_next_root(CATreeRootIterator*, Eterm* keyp); +TreeDbTerm** catree_find_prev_root(CATreeRootIterator*, Eterm* keyp); TreeDbTerm** catree_find_first_root(CATreeRootIterator*); TreeDbTerm** catree_find_last_root(CATreeRootIterator*); -- cgit v1.2.3