[CP] set appropriate errcode to distinguish the rpc has sent out

This commit is contained in:
liucc1997 2024-12-10 09:14:55 +00:00 committed by ob-robot
parent 9c927b5a8f
commit 4b748f9c6d
5 changed files with 9 additions and 4 deletions

View File

@ -33,9 +33,11 @@ common::ObCompressorType get_proxy_compressor_type(ObRpcProxy& proxy) {
int ObSyncRespCallback::handle_resp(int io_err, const char* buf, int64_t sz)
{
if (PNIO_OK != io_err) {
if (PNIO_TIMEOUT == io_err) {
if (PNIO_TIMEOUT == io_err || PNIO_DISCONNECT == io_err || PNIO_PKT_TERMINATE == io_err) {
// these pnio error means not sure rpc was successfully sent
send_ret_ = OB_TIMEOUT;
} else {
// OB_RPC_SEND_ERROR means the rpc must not have been sent out
send_ret_ = OB_RPC_SEND_ERROR;
RPC_LOG_RET(WARN, send_ret_, "pnio error", KP(buf), K(sz), K(io_err));
}

View File

@ -110,6 +110,7 @@ void pn_print_diag_info(pn_comm_t* pn_comm);
#define PNIO_DISCONNECT_NOT_SENT_OUT (-55)
#define PNIO_LISTEN_ERROR (-56)
#define PNIO_PKT_TERMINATE (-57)
#define PNIO_PKT_TERMINATE_NOT_SENT_OUT (-58)
enum {
PN_NORMAL_PKT = 0,

View File

@ -87,8 +87,8 @@ inline void wq_push(write_queue_t* wq, dlink_t* l) {
inline int wq_delete(write_queue_t* wq, dlink_t* l) {
int err = PNIO_OK;
if (dqueue_top(&wq->queue) == l) {
// not to delete the first req of write_queue
if (dqueue_top(&wq->queue) == l && wq->pos > 0) {
// req has been sending, it cannot be deleted
err = PNIO_ERROR;
} else if (l == l->prev) {
// req hasn't been inserted into flush_list

View File

@ -26,6 +26,8 @@ static void pktc_do_cb_exception(pktc_t* io, pktc_cb_t* cb) {
cb->errcode = PNIO_DISCONNECT_NOT_SENT_OUT;
} else if (cb->errcode == PNIO_TIMEOUT) {
cb->errcode = PNIO_TIMEOUT_NOT_SENT_OUT;
} else if (cb->errcode == PNIO_PKT_TERMINATE){
cb->errcode = PNIO_PKT_TERMINATE_NOT_SENT_OUT;
}
pktc_flush_cb(io, req);
}

View File

@ -84,8 +84,8 @@ static void pktc_sk_delete(pktc_sf_t* sf, pktc_sk_t* s) {
pktc_t* io = structof(sf, pktc_t, sf);
rk_info("sk_destroy: s=%p io=%p", s, io);
pktc_sk_destroy(sf, s);
pktc_write_queue_on_sk_destroy(io, s);
pktc_resp_cb_on_sk_destroy(io, s);
pktc_write_queue_on_sk_destroy(io, s);
ib_destroy(&s->ib);
dlink_delete(&s->rl_ready_link);
pktc_sk_free(s);