~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/kernel/src/disk_log_server.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% ``The contents of this file are subject to the Erlang Public License,
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
5
%% 
 
6
%% The contents of this file are subject to the Erlang Public License,
2
7
%% Version 1.1, (the "License"); you may not use this file except in
3
8
%% compliance with the License. You should have received a copy of the
4
9
%% Erlang Public License along with this software. If not, it can be
5
 
%% retrieved via the world wide web at http://www.erlang.org/.
 
10
%% retrieved online at http://www.erlang.org/.
6
11
%% 
7
12
%% Software distributed under the License is distributed on an "AS IS"
8
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
14
%% the License for the specific language governing rights and limitations
10
15
%% under the License.
11
16
%% 
12
 
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
%% AB. All Rights Reserved.''
15
 
%% 
16
 
%%     $Id $
 
17
%% %CopyrightEnd%
17
18
%%
18
19
-module(disk_log_server).
19
20
-behaviour(gen_server).
217
218
%% Spawning a process is a means to avoid deadlock when
218
219
%% disk_log_servers mutually open disk_logs.
219
220
 
220
 
-spec(open_distr_rpc/3 :: ([_], _, _) -> no_return()). % XXX: underspecified
 
221
-spec open_distr_rpc([node()], _, _) -> no_return(). % XXX: underspecified
221
222
 
222
223
open_distr_rpc(Nodes, A, From) ->
223
224
    {AllReplies, BadNodes} = rpc:multicall(Nodes, ?MODULE, dist_open, [A]),
224
225
    {Ok, Bad} = cr(AllReplies, [], []),
225
226
    Old = find_old_nodes(Nodes, AllReplies, BadNodes),
226
 
    NotOk = lists:map(fun(BadNode) -> {BadNode, {error, nodedown}} end, 
227
 
                      BadNodes ++ Old),
 
227
    NotOk = [{BadNode, {error, nodedown}} || BadNode <- BadNodes ++ Old],
228
228
    Reply = {Ok, Bad ++ NotOk},
229
229
    %% Send the reply to the waiting client:
230
230
    gen_server:reply(From, Reply),
313
313
 
314
314
do_accessible_logs() ->
315
315
    LocalSpec = {'$1','_',local},
316
 
    Local0 = lists:map(fun hd/1, ets:match(?DISK_LOG_NAME_TABLE, LocalSpec)),
 
316
    Local0 = [hd(L) || L <- ets:match(?DISK_LOG_NAME_TABLE, LocalSpec)],
317
317
    Local = lists:sort(Local0),
318
318
    Groups0 = ordsets:from_list(pg2:which_groups()),
319
319
    Groups = ordsets:to_list(ordsets:subtract(Groups0, Local)),
320
 
    Dist = lists:filter(fun(L) -> dist_pids(L) =/= [] end, Groups),
 
320
    Dist = [L || L <- Groups, dist_pids(L) =/= []],
321
321
    {Local, Dist}.
322
322
 
323
323
get_local_pid(LogName) ->