Revision 50880bb2 src/raft/RaftManager.cc

View differences:

src/raft/RaftManager.cc
70 70

  
71 71
    if ( logdb->get_raft_state(raft_xml) != 0 )
72 72
    {
73
        std::ostringstream bsr;
74

  
75
        bsr << "bootstrap state";
76

  
77
        logdb->insert_log_record(-1, -1, bsr, 0);
78

  
73 79
        raft_state.replace("TERM", 0);
74 80
        raft_state.replace("VOTEDFOR", -1);
75 81

  
76 82
        raft_state.to_xml(raft_xml);
77 83

  
78
        logdb->insert_raft_state(raft_xml);
84
        logdb->update_raft_state(raft_xml);
79 85

  
80 86
        votedfor = -1;
81 87
        term     = 0;
......
411 417
        frm->start_replica_threads();
412 418
    }
413 419

  
414
    logdb->insert_raft_state(raft_state_xml);
420
    logdb->update_raft_state(raft_state_xml);
415 421

  
416 422
    NebulaLog::log("RCM", Log::INFO, "oned is now the leader of zone");
417 423
}
......
480 486
        frm->stop_replica_threads();
481 487
    }
482 488

  
483
    logdb->insert_raft_state(raft_state_xml);
489
    logdb->update_raft_state(raft_state_xml);
484 490
}
485 491

  
486 492
/* -------------------------------------------------------------------------- */
......
672 678

  
673 679
    pthread_mutex_unlock(&mutex);
674 680

  
675
    logdb->insert_raft_state(raft_state_xml);
681
    logdb->update_raft_state(raft_state_xml);
676 682

  
677 683
    return 0;
678 684
}
......
927 933

  
928 934
        pthread_mutex_unlock(&mutex);
929 935

  
930
        logdb->insert_raft_state(raft_state_xml);
936
        logdb->update_raft_state(raft_state_xml);
931 937

  
932 938
        logdb->get_last_record_index(lindex, lterm);
933 939

  
......
1008 1014

  
1009 1015
        pthread_mutex_unlock(&mutex);
1010 1016

  
1011
        logdb->insert_raft_state(raft_state_xml);
1017
        logdb->update_raft_state(raft_state_xml);
1012 1018

  
1013 1019
        srand(_server_id);
1014 1020

  

Also available in: Unified diff