projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More logging clean-ups. Static type-checking for RPC calls and
[invirt/third/libt4.git]
/
rsm.cc
diff --git
a/rsm.cc
b/rsm.cc
index
4e73f9f
..
7e90b03
100644
(file)
--- a/
rsm.cc
+++ b/
rsm.cc
@@
-115,7
+115,7
@@
void rsm::start() {
thread(&rsm::recovery, this).detach();
}
thread(&rsm::recovery, this).detach();
}
-void rsm::reg1(int proc, handler *h) {
+void rsm::reg1(rpc_protocol::proc_id_t proc, handler *h) {
lock ml(rsm_mutex);
procs[proc] = h;
}
lock ml(rsm_mutex);
procs[proc] = h;
}
@@
-130,7
+130,7
@@
void rsm::recovery() [[noreturn]] {
// XXX iannucci 2013/09/15 -- I don't understand whether accessing
// cfg->view_id in this manner involves a race. I suspect not.
if (join(primary, ml)) {
// XXX iannucci 2013/09/15 -- I don't understand whether accessing
// cfg->view_id in this manner involves a race. I suspect not.
if (join(primary, ml)) {
- LOG("recovery: joined");
+ LOG("joined");
commit_change(cfg->view_id(), ml);
} else {
ml.unlock();
commit_change(cfg->view_id(), ml);
} else {
ml.unlock();
@@
-139,13
+139,13
@@
void rsm::recovery() [[noreturn]] {
}
}
vid_insync = vid_commit;
}
}
vid_insync = vid_commit;
- LOG("recovery: sync vid_insync " << vid_insync);
+ LOG("sync vid_insync " << vid_insync);
if (primary == cfg->myaddr()) {
r = sync_with_backups(ml);
} else {
r = sync_with_primary(ml);
}
if (primary == cfg->myaddr()) {
r = sync_with_backups(ml);
} else {
r = sync_with_primary(ml);
}
- LOG("recovery: sync done");
+ LOG("sync done");
// If there was a commited viewchange during the synchronization, restart
// the recovery
// If there was a commited viewchange during the synchronization, restart
// the recovery
@@
-157,7
+157,7
@@
void rsm::recovery() [[noreturn]] {
myvs.seqno = 1;
inviewchange = false;
}
myvs.seqno = 1;
inviewchange = false;
}
- LOG("recovery: go to sleep " << insync << " " << inviewchange);
+ LOG("go to sleep " << insync << " " << inviewchange);
recovery_cond.wait(ml);
}
}
recovery_cond.wait(ml);
}
}
@@
-285,7
+285,7
@@
void rsm::commit_change(unsigned vid) {
void rsm::commit_change(unsigned vid, lock &) {
if (vid <= vid_commit)
return;
void rsm::commit_change(unsigned vid, lock &) {
if (vid <= vid_commit)
return;
- LOG("commit_change: new view (" << vid << ") last vs (" << last_myvs.vid << "," <<
+ LOG("new view (" << vid << ") last vs (" << last_myvs.vid << "," <<
last_myvs.seqno << ") " << primary << " insync " << insync);
vid_commit = vid;
inviewchange = true;
last_myvs.seqno << ") " << primary << " insync " << insync);
vid_commit = vid;
inviewchange = true;
@@
-297,7
+297,7
@@
void rsm::commit_change(unsigned vid, lock &) {
}
}
-void rsm::execute(int procno, const string & req, string & r) {
+void rsm::execute(rpc_protocol::proc_id_t procno, const string & req, string & r) {
LOG("execute");
handler *h = procs[procno];
VERIFY(h);
LOG("execute");
handler *h = procs[procno];
VERIFY(h);
@@
-313,7
+313,7
@@
void rsm::execute(int procno, const string & req, string & r) {
// number, and invokes it on all members of the replicated state
// machine.
//
// number, and invokes it on all members of the replicated state
// machine.
//
-rsm_client_protocol::status rsm::client_invoke(string & r, int procno, const string & req) {
+rsm_client_protocol::status rsm::client_invoke(string & r, rpc_protocol::proc_id_t procno, const string & req) {
LOG("invoke procno 0x" << hex << procno);
lock ml(invoke_mutex);
vector<string> m;
LOG("invoke procno 0x" << hex << procno);
lock ml(invoke_mutex);
vector<string> m;
@@
-367,7
+367,7
@@
rsm_client_protocol::status rsm::client_invoke(string & r, int procno, const str
// the replica must execute requests in order (with no gaps)
// according to requests' seqno
// the replica must execute requests in order (with no gaps)
// according to requests' seqno
-rsm_protocol::status rsm::invoke(int &, int proc, viewstamp vs, const string & req) {
+rsm_protocol::status rsm::invoke(int &, rpc_protocol::proc_id_t proc, viewstamp vs, const string & req) {
LOG("invoke procno 0x" << hex << proc);
lock ml(invoke_mutex);
vector<string> m;
LOG("invoke procno 0x" << hex << proc);
lock ml(invoke_mutex);
vector<string> m;
@@
-491,7
+491,7
@@
void rsm::set_primary(unsigned vid) {
VERIFY (c.size() > 0);
if (isamember(primary,c)) {
VERIFY (c.size() > 0);
if (isamember(primary,c)) {
- LOG("set_primary: primary stays " << primary);
+ LOG("primary stays " << primary);
return;
}
return;
}
@@
-499,7
+499,7
@@
void rsm::set_primary(unsigned vid) {
for (unsigned i = 0; i < p.size(); i++) {
if (isamember(p[i], c)) {
primary = p[i];
for (unsigned i = 0; i < p.size(); i++) {
if (isamember(p[i], c)) {
primary = p[i];
- LOG("set_primary: primary is " << primary);
+ LOG("primary is " << primary);
return;
}
}
return;
}
}