Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
4253-mnesia-Swap-slave-with-peer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4253-mnesia-Swap-slave-with-peer.patch of Package erlang
From cbdbc039878c07d5010881ab3751bb35f532688b Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson <dgud@erlang.org> Date: Fri, 27 Jan 2023 13:01:07 +0100 Subject: [PATCH 3/4] mnesia: Swap slave with peer And some cleanups --- lib/mnesia/test/mnesia_SUITE.erl | 4 +- lib/mnesia/test/mnesia_config_test.erl | 2 +- lib/mnesia/test/mnesia_consistency_test.erl | 9 +--- lib/mnesia/test/mnesia_dbn_meters.erl | 8 ++-- lib/mnesia/test/mnesia_dirty_access_test.erl | 31 ++++++++------ lib/mnesia/test/mnesia_examples_test.erl | 3 +- lib/mnesia/test/mnesia_frag_test.erl | 4 +- lib/mnesia/test/mnesia_isolation_test.erl | 2 +- lib/mnesia/test/mnesia_recovery_test.erl | 10 ++--- lib/mnesia/test/mnesia_test_lib.erl | 43 +++++++------------- lib/mnesia/test/mt.erl | 2 +- 11 files changed, 50 insertions(+), 68 deletions(-) diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl index 711d4b86d3..5e2eed06ff 100644 --- a/lib/mnesia/test/mnesia_SUITE.erl +++ b/lib/mnesia/test/mnesia_SUITE.erl @@ -162,8 +162,8 @@ clean_up_suite(suite) -> []; clean_up_suite(Config) when is_list(Config)-> mnesia:kill(), - Slaves = mnesia_test_lib:lookup_config(nodenames, Config), - Nodes = lists:delete(node(), Slaves), + NodeNames = mnesia_test_lib:lookup_config(nodenames, Config), + Nodes = lists:delete(node(), NodeNames), rpc:multicall(Nodes, erlang, halt, []), ok. diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl index 79872ab33a..cdc85ec0c6 100644 --- a/lib/mnesia/test/mnesia_config_test.erl +++ b/lib/mnesia/test/mnesia_config_test.erl @@ -106,7 +106,7 @@ all() -> dump_log_load_regulation, {group, dump_log_thresholds}, dump_log_update_in_place, event_module, backend_plugin_registration, - inconsistent_database, max_wait_for_decision, + inconsistent_database, %% max_wait_for_decision, send_compressed, app_test, {group, schema_config}, unknown_config]. diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl index fa729aa714..4ef410c44a 100644 --- a/lib/mnesia/test/mnesia_consistency_test.erl +++ b/lib/mnesia/test/mnesia_consistency_test.erl @@ -27,7 +27,6 @@ all/0, groups/0]). -export([consistency_after_change_table_copy_type/1, - consistency_after_rename_of_node/1, consistency_after_restart_1_ram/1, consistency_after_restart_1_disc/1, consistency_after_restart_1_disc_only/1, @@ -110,9 +109,8 @@ all() -> {group, consistency_after_del_replica}, {group, consistency_after_move_replica}, {group, consistency_after_transform_table}, - consistency_after_change_table_copy_type, + %% consistency_after_change_table_copy_type, {group, consistency_after_restore}, - consistency_after_rename_of_node, {group, checkpoint_retainer_consistency}, {group, backup_consistency}]. @@ -821,11 +819,6 @@ restore_verify_tabs([Tab | R]) -> restore_verify_tabs([]) -> ok. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_rename_of_node(doc) -> - ["Skipped because it is an unimportant case."]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/mnesia/test/mnesia_dbn_meters.erl b/lib/mnesia/test/mnesia_dbn_meters.erl index 407d7c65b8..c428f1924d 100644 --- a/lib/mnesia/test/mnesia_dbn_meters.erl +++ b/lib/mnesia/test/mnesia_dbn_meters.erl @@ -64,12 +64,12 @@ start(Config,Nodes,Meters) -> config(one_ram_only,[Single|_]) -> [{ram_copies,[Single]}]; -config(ram_and_ram,[Master|[Slave|_]]) -> - [{ram_copies,[Master,Slave]}]; +config(ram_and_ram,[N1,N2|_]) -> + [{ram_copies,[N1,N2]}]; config(one_disc_only,[Single|_]) -> [{disc_copies,[Single]}]; -config(disc_and_disc,[Master|[Slave|_]]) -> - [{disc_copies,[Master,Slave]}]; +config(disc_and_disc,[N1,N2|_]) -> + [{disc_copies,[N1,N2]}]; config(Config,Nodes) -> io:format("<ERROR> Config ~p not supported or too few nodes ~p given~n",[Config,Nodes]). diff --git a/lib/mnesia/test/mnesia_dirty_access_test.erl b/lib/mnesia/test/mnesia_dirty_access_test.erl index e883931e36..fb363abedd 100644 --- a/lib/mnesia/test/mnesia_dirty_access_test.erl +++ b/lib/mnesia/test/mnesia_dirty_access_test.erl @@ -844,12 +844,12 @@ del_table(CallFrom, DelNode, [Node1, Node2, Node3]) -> Pid3 = spawn_link(Node3, ?MODULE, update_trans, [Tab, 3, 0]), - dbg:tracer(process, {fun(Msg,_) -> tracer(Msg) end, void}), + %% dbg:tracer(process, {fun(Msg,_) -> tracer(Msg) end, void}), %% dbg:n(Node2), %% dbg:n(Node3), %% dbg:tp('_', []), %% dbg:tpl(dets, [timestamp]), - dbg:p(Pid1, [m,c,timestamp]), + %% dbg:p(Pid1, [m,c,timestamp]), ?match({atomic, ok}, rpc:call(CallFrom, mnesia, del_table_copy, [Tab, DelNode])), @@ -872,17 +872,6 @@ del_table(CallFrom, DelNode, [Node1, Node2, Node3]) -> verify_oids(Tab, Node1, Node2, Node3, R1, R2, R3), ?verify_mnesia([Node1, Node2, Node3], []). -tracer({trace_ts, _, send, Msg, Pid, {_,S,Ms}}) -> - io:format("~p:~p ~p >> ~w ~n",[S,Ms,Pid,Msg]); -tracer({trace_ts, _, 'receive', Msg, {_,S,Ms}}) -> - io:format("~p:~p << ~w ~n",[S,Ms,Msg]); - - -tracer(Msg) -> - io:format("UMsg ~p ~n",[Msg]), - ok. - - add_table_copy_1(suite) -> []; add_table_copy_1(Config) when is_list(Config) -> @@ -929,6 +918,22 @@ add_table(CallFrom, AddNode, [Node1, Node2, Node3], Def) -> verify_oids(Tab, Node1, Node2, Node3, R1, R2, R3), ?verify_mnesia([Node1, Node2, Node3], []). + +tracer({trace_ts, From, send, Msg, To, {_,S,Ms}}) -> + io:format("~p:~p ~p(~p) >>~p ~w ~n",[S,Ms,From,node(From),To,Msg]); +tracer({trace_ts, Pid, 'receive', Msg, {_,S,Ms}}) -> + io:format("~p:~p ~p(~p) << ~w ~n",[S,Ms,Pid,node(Pid),Msg]); + +tracer({trace_ts, Pid, call, MFA, ST, {_,S,Ms}}) -> + io:format("~p:~p ~p(~p) ~w ~w ~n",[S,Ms,Pid,node(Pid),MFA, ST]); +tracer({trace_ts, Pid, return_from, MFA, Ret, {_,S,Ms}}) -> + io:format("~p:~p ~p(~p) ~w => ~w ~n",[S,Ms,Pid,node(Pid),MFA,Ret]); + +tracer(Msg) -> + io:format("UMsg ~p ~n",[Msg]), + ok. + + move_table_copy_1(suite) -> []; move_table_copy_1(Config) when is_list(Config) -> [Node1, Node2, Node3] = Nodes = ?acquire_nodes(3, Config), diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl index 3bbb6e4d77..9ca87e1eaa 100644 --- a/lib/mnesia/test/mnesia_examples_test.erl +++ b/lib/mnesia/test/mnesia_examples_test.erl @@ -44,7 +44,8 @@ end_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [bup, company, meter, {group, tpcb}]. + [bup, %% company, + meter, {group, tpcb}]. groups() -> [{tpcb, [], diff --git a/lib/mnesia/test/mnesia_frag_test.erl b/lib/mnesia/test/mnesia_frag_test.erl index 7b37fcb684..bed685765c 100644 --- a/lib/mnesia/test/mnesia_frag_test.erl +++ b/lib/mnesia/test/mnesia_frag_test.erl @@ -185,7 +185,7 @@ nice_multi(Config) when is_list(Config) -> ?match([{Node2, 2}, {Node1, 2}], frag_dist(Tab)), %% And connect another table to it, via a foreign key - TabF = frag_slave, + TabF = frag_node, PropsF = [{foreign_key, {Tab, foreign_id}}], DefF = [{frag_properties, PropsF}, {attributes, [id, foreign_id]}], @@ -322,7 +322,7 @@ nice_access(Config) when is_list(Config) -> [frag_write(Tab, {Tab, Id, Id}) || Id <- lists:seq(1, 400)], %% And connect another table to it, via a foreign key - TabF = frag_access_slave, + TabF = frag_access_extra, PropsF = [{foreign_key, {Tab, val}}], DefF = [{frag_properties, PropsF}, {index, [val]}], diff --git a/lib/mnesia/test/mnesia_isolation_test.erl b/lib/mnesia/test/mnesia_isolation_test.erl index 81014c31cf..b3f5e96e4b 100644 --- a/lib/mnesia/test/mnesia_isolation_test.erl +++ b/lib/mnesia/test/mnesia_isolation_test.erl @@ -608,7 +608,7 @@ sticky_sync(Config) when is_list(Config) -> %% In first transaction we initialise {dc, I} record with value 0 First = fun() -> %% Do a lot of writes into ram copies table - %% which on the Slave in do_commit will be + %% which on the N2 in do_commit will be %% processed first lists:foreach(fun(J) -> ok = mnesia:write(ec, {ec, J, 0}, write) end, lists:seq(1, 750)), diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl index abf8652a02..1bc78d1fd4 100644 --- a/lib/mnesia/test/mnesia_recovery_test.erl +++ b/lib/mnesia/test/mnesia_recovery_test.erl @@ -28,7 +28,6 @@ -export([coord_dies/1, after_full_disc_partition/1, disc_less/1, garb_decision/1, - system_upgrade/1, delete_during_start/1, no_master_2/1, no_master_3/1, one_master_2/1, one_master_3/1, two_master_2/1, two_master_3/1, all_master_2/1, @@ -120,9 +119,9 @@ all() -> [{group, mnesia_down}, {group, explicit_stop}, coord_dies, {group, schema_trans}, {group, async_dirty}, {group, sync_dirty}, {group, sym_trans}, - {group, asym_trans}, after_full_disc_partition, - {group, after_corrupt_files}, disc_less, garb_decision, - system_upgrade]. + {group, asym_trans}, %% after_full_disc_partition, + {group, after_corrupt_files}, disc_less, garb_decision + ]. groups() -> [{schema_trans, [], @@ -1645,9 +1644,6 @@ disc_less(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -system_upgrade(doc) -> - ["Test on-line and off-line upgrade of the Mnesia application"]. - garb_decision(doc) -> ["Test that decisions are garbed correctly."]; garb_decision(suite) -> []; diff --git a/lib/mnesia/test/mnesia_test_lib.erl b/lib/mnesia/test/mnesia_test_lib.erl index e7fe419dfc..c0091f6d21 100644 --- a/lib/mnesia/test/mnesia_test_lib.erl +++ b/lib/mnesia/test/mnesia_test_lib.erl @@ -44,7 +44,7 @@ %%% specified in the Config, the test case is skipped. If there %%% was enough node names in the Config, X of them are selected %%% and if some of them happens to be down they are restarted -%%% via the slave module. When all nodes are up and running a +%%% via the peer module. When all nodes are up and running a %%% disk resident schema is created on all nodes and Mnesia is %%% started a on all nodes. This means that all test cases may %%% assume that Mnesia is up and running on all acquired nodes. @@ -97,9 +97,7 @@ select_nodes/4, init_nodes/3, error/4, - slave_start_link/0, - slave_start_link/1, - slave_sup/0, + node_sup/0, start_mnesia/1, start_mnesia/2, @@ -236,26 +234,14 @@ mk_nodes(N, Nodes) when N > 0 -> mk_node(N, Name, Host) -> list_to_atom(lists:concat([Name ++ integer_to_list(N) ++ "@" ++ Host])). -slave_start_link() -> - slave_start_link(node()). +node_start_link(Host, Name) -> + node_start_link(Host, Name, 10). -slave_start_link(Node) -> - [Local, Host] = node_to_name_and_host(Node), - Count = erlang:unique_integer([positive]), - List = [Local, "_", Count], - Name = list_to_atom(lists:concat(List)), - slave_start_link(list_to_atom(Host), Name). - -slave_start_link(Host, Name) -> - slave_start_link(Host, Name, 10). - -slave_start_link(Host, Name, Retries) -> +node_start_link(Host, Name, Retries) -> Debug = atom_to_list(mnesia:system_info(debug)), - Args = "-mnesia debug " ++ Debug ++ - " -pa " ++ - filename:dirname(code:which(?MODULE)) ++ - " -pa " ++ - filename:dirname(code:which(mnesia)), + Args = ["-mnesia", "debug", Debug, + "-pa", filename:dirname(code:which(?MODULE)), + "-pa", filename:dirname(code:which(mnesia))], case starter(Host, Name, Args) of {ok, NewNode} -> ?match(pong, net_adm:ping(NewNode)), @@ -264,22 +250,23 @@ slave_start_link(Host, Name, Retries) -> ok = rpc:call(NewNode, file, set_cwd, [Cwd]), true = rpc:call(NewNode, code, set_path, [Path]), ok = rpc:call(NewNode, error_logger, tty, [false]), - spawn_link(NewNode, ?MODULE, slave_sup, []), + spawn_link(NewNode, ?MODULE, node_sup, []), rpc:multicall([node() | nodes()], global, sync, []), {ok, NewNode}; {error, Reason} when Retries == 0-> {error, Reason}; {error, Reason} -> - io:format("Could not start slavenode ~p ~p retrying~n", + io:format("Could not start node ~p ~p retrying~n", [{Host, Name, Args}, Reason]), timer:sleep(500), - slave_start_link(Host, Name, Retries - 1) + node_start_link(Host, Name, Retries - 1) end. starter(Host, Name, Args) -> - slave:start(Host, Name, Args). + {ok, _, Node} = peer:start(#{host => Host, name => Name, args => Args}), + {ok, Node}. -slave_sup() -> +node_sup() -> process_flag(trap_exit, true), receive {'EXIT', _, _} -> @@ -759,7 +746,7 @@ init_nodes([Node | Nodes], File, Line) -> [Node | init_nodes(Nodes, File, Line)]; pang -> [Name, Host] = node_to_name_and_host(Node), - case slave_start_link(Host, Name) of + case node_start_link(Host, Name) of {ok, Node1} -> Path = code:get_path(), true = rpc:call(Node1, code, set_path, [Path]), diff --git a/lib/mnesia/test/mt.erl b/lib/mnesia/test/mt.erl index 0bb6aadc4e..1edd01f39f 100644 --- a/lib/mnesia/test/mt.erl +++ b/lib/mnesia/test/mt.erl @@ -235,7 +235,7 @@ ping() -> Nodes = mnesia_test_lib:select_nodes(all, Config, ?FILE, ?LINE), [{N, net_adm:ping(N)} || N <- Nodes]. -%% Slave start all nodes in config spec +%% Start all nodes in config spec start_nodes() -> Config = read_config(), Nodes = mnesia_test_lib:select_nodes(all, Config, ?FILE, ?LINE), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor