Skip to content

Commit

Permalink
ENHANCE: Enhance error handling where uses memcached_vdo() naver#167
Browse files Browse the repository at this point in the history
  • Loading branch information
uhm0311 committed Mar 16, 2022
1 parent 222d6cf commit 076c742
Show file tree
Hide file tree
Showing 9 changed files with 625 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libmemcached/auto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,21 @@ static memcached_return_t text_incr_decr(memcached_st *ptr,
#endif
/* Send command header */
memcached_return_t rc= memcached_vdo(instance, vector, 7, true);
#ifdef MEMCACHED_VDO_ERROR_HANDLING
if (memcached_failed(rc))
{
if (rc == MEMCACHED_WRITE_FAILURE)
memcached_io_reset(instance);
return memcached_set_error(*instance, rc, MEMCACHED_AT);
}

if (ptr->flags.no_reply)
return MEMCACHED_SUCCESS;
#else
if (ptr->flags.no_reply or memcached_failed(rc))
{
return rc;
#endif
}

char result[MEMCACHED_DEFAULT_COMMAND_SIZE];
Expand Down Expand Up @@ -214,12 +226,22 @@ static memcached_return_t binary_incr_decr(memcached_st *ptr, uint8_t cmd,
#ifdef ENABLE_REPLICATION
do_action:
#endif
#ifdef MEMCACHED_VDO_ERROR_HANDLING
memcached_return_t rc= memcached_vdo(instance, vector, 3, true);
if (memcached_failed(rc))
{
if (rc == MEMCACHED_WRITE_FAILURE)
memcached_io_reset(instance);
return memcached_set_error(*instance, rc, MEMCACHED_AT);
}
#else
memcached_return_t rc;
if (memcached_failed(rc= memcached_vdo(instance, vector, 3, true)))
{
memcached_io_reset(instance);
return (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
#endif

if (no_reply)
return MEMCACHED_SUCCESS;
Expand Down
Loading

0 comments on commit 076c742

Please sign in to comment.