aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_catree.c
diff options
context:
space:
mode:
authorKjell Winblad <[email protected]>2019-04-18 11:33:56 +0200
committerKjell Winblad <[email protected]>2019-04-18 13:27:20 +0200
commit57905f018f7710ce8951bda2dc24cd4f87c8e488 (patch)
tree1b636412f9583fe48519783e724c746133c7227f /erts/emulator/beam/erl_db_catree.c
parentc4484ca7754a98c0f7d31ab945f1d18881b0d5be (diff)
downloadotp-57905f018f7710ce8951bda2dc24cd4f87c8e488.tar.gz
otp-57905f018f7710ce8951bda2dc24cd4f87c8e488.tar.bz2
otp-57905f018f7710ce8951bda2dc24cd4f87c8e488.zip
Fix broken ETS test case
This commit fixes an ETS test case that tests the decentralized memory counter in tables of type ordered_set with the write_concurrency option turned on. The test case assumed that the memory consumption of the table would only grow monotonically when terms are inserted. However, this was not the case when the emulator was compiled in debug mode as random splits and joins of CA tree nodes could happen. This commit fixes the test case by disabling random splits and joins in the tested table.
Diffstat (limited to 'erts/emulator/beam/erl_db_catree.c')
-rw-r--r--erts/emulator/beam/erl_db_catree.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_db_catree.c b/erts/emulator/beam/erl_db_catree.c
index 962fe4c4f8..e0d5e44f58 100644
--- a/erts/emulator/beam/erl_db_catree.c
+++ b/erts/emulator/beam/erl_db_catree.c
@@ -647,7 +647,8 @@ static int dbg_fastrand(void)
static void dbg_provoke_random_splitjoin(DbTableCATree* tb,
DbTableCATreeNode* base_node)
{
- if (tb->common.status & DB_CATREE_FORCE_SPLIT)
+ if (tb->common.status & DB_CATREE_FORCE_SPLIT ||
+ !(tb->common.status & DB_CATREE_DEBUG_RANDOM_SPLIT_JOIN))
return;
switch (dbg_fastrand() % 8) {
@@ -1406,6 +1407,9 @@ int db_create_catree(Process *p, DbTable *tbl)
tb->deletion = 0;
tb->base_nodes_to_free_list = NULL;
tb->nr_of_deleted_items = 0;
+#ifdef DEBUG
+ tbl->common.status |= DB_CATREE_DEBUG_RANDOM_SPLIT_JOIN;
+#endif
erts_atomic_init_relb(&(tb->root), (erts_aint_t)root);
return DB_ERROR_NONE;
}
@@ -2257,6 +2261,14 @@ void db_catree_force_split(DbTableCATree* tb, int on)
tb->common.status &= ~DB_CATREE_FORCE_SPLIT;
}
+void db_catree_debug_random_split_join(DbTableCATree* tb, int on)
+{
+ if (on)
+ tb->common.status |= DB_CATREE_DEBUG_RANDOM_SPLIT_JOIN;
+ else
+ tb->common.status &= ~DB_CATREE_DEBUG_RANDOM_SPLIT_JOIN;
+}
+
void db_calc_stats_catree(DbTableCATree* tb, DbCATreeStats* stats)
{
DbTableCATreeNode* stack[ERL_DB_CATREE_MAX_ROUTE_NODE_LAYER_HEIGHT];