aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2010-10-21 08:54:42 +0200
committerHans Bolinder <[email protected]>2010-10-21 08:54:42 +0200
commitce97ee6c7747fa5211257957688082e97d69d57f (patch)
treee33f9ca9ae024e59be80af06a450a99c7b8177cc /lib/stdlib
parent4921e5546bfeedc22ae7109e169a08bc4cc01739 (diff)
parentd98b14f2c2c808491e1a5942820cddaab4d65742 (diff)
downloadotp-ce97ee6c7747fa5211257957688082e97d69d57f.tar.gz
otp-ce97ee6c7747fa5211257957688082e97d69d57f.tar.bz2
otp-ce97ee6c7747fa5211257957688082e97d69d57f.zip
Merge branch 'hb/stdlib/dets_insert_new/OTP-8856' into dev
* hb/stdlib/dets_insert_new/OTP-8856: Fix a bug in dets:insert_new()
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/dets.erl3
-rw-r--r--lib/stdlib/test/dets_SUITE.erl31
2 files changed, 28 insertions, 6 deletions
diff --git a/lib/stdlib/src/dets.erl b/lib/stdlib/src/dets.erl
index 4584b8184f..cc1f35914a 100644
--- a/lib/stdlib/src/dets.erl
+++ b/lib/stdlib/src/dets.erl
@@ -1381,9 +1381,6 @@ stream_op(Head, Pids, C, N, Pid, {lookup_keys,Keys}, Fxd) ->
stream_op(Head, Pids, C, N, Pid, {insert, _Objects} = Op, Fxd) ->
NC = [Op | C],
stream_loop(Head, [Pid | Pids], NC, N, Fxd);
-stream_op(Head, Pids, C, N, Pid, {insert_new, _Objects} = Op, Fxd) ->
- NC = [Op | C],
- stream_loop(Head, [Pid | Pids], NC, N, Fxd);
stream_op(Head, Pids, C, N, Pid, {delete_key, _Keys} = Op, Fxd) ->
NC = [Op | C],
stream_loop(Head, [Pid | Pids], NC, N, Fxd);
diff --git a/lib/stdlib/test/dets_SUITE.erl b/lib/stdlib/test/dets_SUITE.erl
index 760e610e00..b32d372889 100644
--- a/lib/stdlib/test/dets_SUITE.erl
+++ b/lib/stdlib/test/dets_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -50,7 +50,7 @@
otp_4208/1, otp_4989/1, many_clients/1, otp_4906/1, otp_5402/1,
simultaneous_open/1, insert_new/1, repair_continuation/1,
otp_5487/1, otp_6206/1, otp_6359/1, otp_4738/1, otp_7146/1,
- otp_8070/1]).
+ otp_8070/1, otp_8856/1]).
-export([dets_dirty_loop/0]).
@@ -108,7 +108,7 @@ all(suite) ->
cache_duplicate_bags_v9, otp_4208, otp_4989, many_clients,
otp_4906, otp_5402, simultaneous_open, insert_new,
repair_continuation, otp_5487, otp_6206, otp_6359, otp_4738,
- otp_7146, otp_8070]}
+ otp_7146, otp_8070, otp_8856]}
end.
not_run(suite) -> [];
@@ -3701,6 +3701,31 @@ otp_8070(Config) when is_list(Config) ->
file:delete(File),
ok.
+otp_8856(doc) ->
+ ["OTP-8856. insert_new() bug."];
+otp_8856(suite) ->
+ [];
+otp_8856(Config) when is_list(Config) ->
+ Tab = otp_8856,
+ File = filename(Tab, Config),
+ file:delete(File),
+ Me = self(),
+ ?line {ok, _} = dets:open_file(Tab, [{type, bag}, {file, File}]),
+ spawn(fun()-> Me ! {1, dets:insert(Tab, [])} end),
+ spawn(fun()-> Me ! {2, dets:insert_new(Tab, [])} end),
+ ?line ok = dets:close(Tab),
+ ?line receive {1, ok} -> ok end,
+ ?line receive {2, true} -> ok end,
+ file:delete(File),
+
+ ?line {ok, _} = dets:open_file(Tab, [{type, set}, {file, File}]),
+ spawn(fun() -> dets:delete(Tab, 0) end),
+ spawn(fun() -> Me ! {3, dets:insert_new(Tab, {0,0})} end),
+ ?line ok = dets:close(Tab),
+ ?line receive {3, true} -> ok end,
+ file:delete(File),
+ ok.
+
%%
%% Parts common to several test cases
%%