~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/mnesia/src/mnesia_checkpoint.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
635
635
 
636
636
init(Cp) ->
637
637
    process_flag(trap_exit, true),
 
638
    process_flag(priority, high), %% Needed dets files might starve the system
638
639
    Name = Cp#checkpoint_args.name,
639
640
    Props = [set, public, {keypos, 2}],
640
641
    case catch ?ets_new_table(mnesia_pending_checkpoint, Props) of
800
801
        {_From, {retain, Tid, Tab, Key, OldRecs}}
801
802
        when Cp#checkpoint_args.wait_for_old == [] ->
802
803
            R = val({Tab, {retainer, Name}}),
 
804
            PendingTab = Cp#checkpoint_args.pending_tab,
803
805
            case R#retainer.really_retain of
 
806
                true when PendingTab =:= undefined ->
 
807
                    Store = R#retainer.store,
 
808
                    case retainer_get(Store, Key) of
 
809
                        [] ->  retainer_put(Store, {Tab, Key, OldRecs});
 
810
                        _ ->   already_retained
 
811
                    end;
804
812
                true ->
805
 
                    PendingTab = Cp#checkpoint_args.pending_tab,
806
 
                    case catch ?ets_lookup_element(PendingTab, Tid, 1) of
807
 
                        {'EXIT', _} ->
 
813
                    case ets:member(PendingTab, Tid) of
 
814
                        true -> ignore;
 
815
                        false -> 
808
816
                            Store = R#retainer.store,
809
817
                            case retainer_get(Store, Key) of
810
 
                                [] ->
811
 
                                    retainer_put(Store, {Tab, Key, OldRecs});
812
 
                                _ ->
813
 
                                    already_retained
814
 
                            end;
815
 
                        pending ->
816
 
                            ignore
 
818
                                [] ->  retainer_put(Store, {Tab, Key, OldRecs});
 
819
                                _ ->   already_retained
 
820
                            end                 
817
821
                    end;
818
822
                false ->
819
823
                    ignore