forked from vitalif/vitastor
Ignore EPOLL_CTL_DEL ENOENT, fix detection of the rollback version
parent
393fe75900
commit
6488d0044a
2
Makefile
2
Makefile
|
@ -44,7 +44,7 @@ osd_peering.o: osd_peering.cpp osd.h osd_ops.h osd_peering_pg.h ringloop.h
|
||||||
g++ $(CXXFLAGS) -c -o $@ $<
|
g++ $(CXXFLAGS) -c -o $@ $<
|
||||||
osd_cluster.o: osd_cluster.cpp osd.h osd_ops.h ringloop.h
|
osd_cluster.o: osd_cluster.cpp osd.h osd_ops.h ringloop.h
|
||||||
g++ $(CXXFLAGS) -c -o $@ $<
|
g++ $(CXXFLAGS) -c -o $@ $<
|
||||||
http_client.o: http_client.cpp http_client.h osd.h osd_ops.h
|
http_client.o: http_client.cpp http_client.h
|
||||||
g++ $(CXXFLAGS) -c -o $@ $<
|
g++ $(CXXFLAGS) -c -o $@ $<
|
||||||
etcd_state_client.o: etcd_state_client.cpp etcd_state_client.h http_client.h pg_states.h
|
etcd_state_client.o: etcd_state_client.cpp etcd_state_client.h http_client.h pg_states.h
|
||||||
g++ $(CXXFLAGS) -c -o $@ $<
|
g++ $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
7
osd.cpp
7
osd.cpp
|
@ -250,7 +250,10 @@ void osd_t::set_fd_handler(int fd, std::function<void(int, int)> handler)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, NULL);
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0 && errno != ENOENT)
|
||||||
|
{
|
||||||
|
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));
|
||||||
|
}
|
||||||
epoll_handlers.erase(fd);
|
epoll_handlers.erase(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,7 +419,7 @@ void osd_t::stop_client(int peer_fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clients.erase(it);
|
clients.erase(it);
|
||||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, peer_fd, NULL) < 0)
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, peer_fd, NULL) < 0 && errno != ENOENT)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));
|
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
2
osd.h
2
osd.h
|
@ -324,7 +324,7 @@ class osd_t
|
||||||
|
|
||||||
// flushing, recovery and backfill
|
// flushing, recovery and backfill
|
||||||
void submit_pg_flush_ops(pg_num_t pg_num);
|
void submit_pg_flush_ops(pg_num_t pg_num);
|
||||||
void handle_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t peer_osd, int retval);
|
void handle_flush_op(bool rollback, pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t peer_osd, int retval);
|
||||||
void submit_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, bool rollback, osd_num_t peer_osd, int count, obj_ver_id *data);
|
void submit_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, bool rollback, osd_num_t peer_osd, int count, obj_ver_id *data);
|
||||||
bool pick_next_recovery(osd_recovery_op_t &op);
|
bool pick_next_recovery(osd_recovery_op_t &op);
|
||||||
void submit_recovery_op(osd_recovery_op_t *op);
|
void submit_recovery_op(osd_recovery_op_t *op);
|
||||||
|
|
|
@ -58,7 +58,7 @@ void osd_t::submit_pg_flush_ops(pg_num_t pg_num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void osd_t::handle_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t peer_osd, int retval)
|
void osd_t::handle_flush_op(bool rollback, pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t peer_osd, int retval)
|
||||||
{
|
{
|
||||||
if (pgs.find(pg_num) == pgs.end() || pgs[pg_num].flush_batch != fb)
|
if (pgs.find(pg_num) == pgs.end() || pgs[pg_num].flush_batch != fb)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,14 @@ void osd_t::handle_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t pee
|
||||||
if (retval != 0)
|
if (retval != 0)
|
||||||
{
|
{
|
||||||
if (peer_osd == this->osd_num)
|
if (peer_osd == this->osd_num)
|
||||||
throw std::runtime_error(std::string("Error while doing local flush operation: ") + strerror(-retval));
|
{
|
||||||
|
throw std::runtime_error(
|
||||||
|
std::string(rollback
|
||||||
|
? "Error while doing local rollback operation: "
|
||||||
|
: "Error while doing local stabilize operation: "
|
||||||
|
) + strerror(-retval)
|
||||||
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error while doing flush on OSD %lu: %s\n", osd_num, strerror(-retval));
|
printf("Error while doing flush on OSD %lu: %s\n", osd_num, strerror(-retval));
|
||||||
|
@ -158,7 +165,7 @@ void osd_t::submit_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, bool rollback
|
||||||
.callback = [this, op, pg_num, fb](blockstore_op_t *bs_op)
|
.callback = [this, op, pg_num, fb](blockstore_op_t *bs_op)
|
||||||
{
|
{
|
||||||
add_bs_subop_stats(op);
|
add_bs_subop_stats(op);
|
||||||
handle_flush_op(pg_num, fb, this->osd_num, bs_op->retval);
|
handle_flush_op(bs_op->opcode == BS_OP_ROLLBACK, pg_num, fb, this->osd_num, bs_op->retval);
|
||||||
delete op;
|
delete op;
|
||||||
},
|
},
|
||||||
.len = (uint32_t)count,
|
.len = (uint32_t)count,
|
||||||
|
@ -186,7 +193,7 @@ void osd_t::submit_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, bool rollback
|
||||||
};
|
};
|
||||||
op->callback = [this, pg_num, fb](osd_op_t *op)
|
op->callback = [this, pg_num, fb](osd_op_t *op)
|
||||||
{
|
{
|
||||||
handle_flush_op(pg_num, fb, clients[op->peer_fd].osd_num, op->reply.hdr.retval);
|
handle_flush_op(op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK, pg_num, fb, clients[op->peer_fd].osd_num, op->reply.hdr.retval);
|
||||||
delete op;
|
delete op;
|
||||||
};
|
};
|
||||||
outbox_push(clients[peer_fd], op);
|
outbox_push(clients[peer_fd], op);
|
||||||
|
|
|
@ -172,7 +172,7 @@ void pg_obj_state_check_t::finish_object()
|
||||||
{
|
{
|
||||||
pcs.stable_ver = list[i].version;
|
pcs.stable_ver = list[i].version;
|
||||||
}
|
}
|
||||||
if (list[i].version <= target_ver)
|
if (list[i].version <= target_ver && !pcs.max_target)
|
||||||
{
|
{
|
||||||
pcs.max_target = list[i].version;
|
pcs.max_target = list[i].version;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue