From 8dfd5de923a70f8e9c2563fa4673202b4bab6333 Mon Sep 17 00:00:00 2001 From: vraatikka Date: Thu, 22 Aug 2013 00:01:44 +0300 Subject: [PATCH] Fix merge --- server/core/dcb.c | 59 ++++---------------------- server/core/poll.c | 48 +++------------------ server/include/dcb.h | 1 - server/modules/protocol/mysql_client.c | 59 +++++++------------------- 4 files changed, 30 insertions(+), 137 deletions(-) diff --git a/server/core/dcb.c b/server/core/dcb.c index dcae2d201..474579d59 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -95,7 +95,6 @@ DCB *rval; rval->data = NULL; rval->protocol = NULL; rval->session = NULL; - simple_mutex_init(&rval->mutex, "dcb mutex"); memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics bitmask_init(&rval->memdata.bitmask); rval->memdata.next = NULL; @@ -343,7 +342,6 @@ GWPROTOCOL *funcs; int dcb_read(DCB *dcb, GWBUF **head) { -<<<<<<< TREE GWBUF *buffer = NULL; int b, n = 0; int rc = 0; @@ -366,10 +364,6 @@ int eno = 0; return -1; } -======= -GWBUF *buffer = NULL; -int b, n = 0; ->>>>>>> MERGE-SOURCE while (b > 0) { int bufsize = b < MAX_BUFFER_SIZE ? b : MAX_BUFFER_SIZE; @@ -478,28 +472,12 @@ int w, saved_errno = 0; saved_errno = errno; if (w < 0) { -<<<<<<< TREE skygw_log_write( LOGFILE_ERROR, "%lu [dcb_write] Write to fd %d failed, errno %d", pthread_self(), dcb->fd, saved_errno); -======= - skygw_log_write( - LOGFILE_ERROR, - "%lu [dcb_write] Write to fd %d failed, errno %d", - pthread_self(), - dcb->fd, - saved_errno); - skygw_log_write( - LOGFILE_TRACE, - "%lu [dcb_write] Write to fd %d failed, errno %d", - pthread_self(), - dcb->fd, - saved_errno); - ->>>>>>> MERGE-SOURCE break; } @@ -569,35 +547,16 @@ int saved_errno = 0; saved_errno = errno; if (w < 0) { -<<<<<<< TREE - skygw_log_write( - LOGFILE_ERROR, - "%lu [dcb_drain_writeq] Write to fd %d failed, " - "errno %d", - pthread_self(), - dcb->fd, - saved_errno); - break; -======= - skygw_log_write( - LOGFILE_ERROR, - "%lu [dcb_drain_writeq] Write to fd %d failed, " - "errno %d", - pthread_self(), - dcb->fd, - saved_errno); - skygw_log_write( - LOGFILE_TRACE, - "%lu [dcb_drain_writeq] Write to df %d failed, " - "errno %d", - pthread_self(), - dcb->fd, - saved_errno); - - break; ->>>>>>> MERGE-SOURCE + skygw_log_write( + LOGFILE_ERROR, + "%lu [dcb_drain_writeq] Write to fd %d failed, " + "errno %d", + pthread_self(), + dcb->fd, + saved_errno); + break; } - + /* * Pull the number of bytes we have written from * queue with have. diff --git a/server/core/poll.c b/server/core/poll.c index 5644a9da4..c0921ede1 100644 --- a/server/core/poll.c +++ b/server/core/poll.c @@ -195,28 +195,14 @@ bool no_op = FALSE; { DCB *dcb = (DCB *)events[i].data.ptr; __uint32_t ev = events[i].events; -<<<<<<< TREE skygw_log_write( LOGFILE_TRACE, "%lu [poll_waitevents] event %d", pthread_self(), ev); -======= - simple_mutex_t* mutex = &dcb->mutex; ->>>>>>> MERGE-SOURCE -<<<<<<< TREE -======= - simple_mutex_lock(mutex, TRUE); - - skygw_log_write( - LOGFILE_TRACE, - "%lu [poll_waitevents] event %d", - pthread_self(), - ev); ->>>>>>> MERGE-SOURCE + if (DCB_ISZOMBIE(dcb)) -<<<<<<< TREE { skygw_log_write( LOGFILE_TRACE, @@ -224,41 +210,23 @@ bool no_op = FALSE; pthread_self()); continue; } -======= - { - skygw_log_write( - LOGFILE_TRACE, - "%lu [poll_waitevents] dcb is zombie", - pthread_self()); - simple_mutex_unlock(mutex); - continue; - } ->>>>>>> MERGE-SOURCE if (ev & EPOLLERR) { atomic_add(&pollStats.n_error, 1); dcb->func.error(dcb); -<<<<<<< TREE + if (DCB_ISZOMBIE(dcb)) { -======= - if (DCB_ISZOMBIE(dcb)) { - simple_mutex_unlock(mutex); ->>>>>>> MERGE-SOURCE continue; } } if (ev & EPOLLHUP) { - atomic_add(&pollStats.n_hup, 1); + atomic_add(&pollStats.n_hup, 1); dcb->func.hangup(dcb); -<<<<<<< TREE + if (DCB_ISZOMBIE(dcb)) { -======= - if (DCB_ISZOMBIE(dcb)) { - simple_mutex_unlock(mutex); ->>>>>>> MERGE-SOURCE - continue; + continue; } } if (ev & EPOLLOUT) @@ -296,14 +264,8 @@ bool no_op = FALSE; dcb->func.read(dcb); } } -<<<<<<< TREE } /**< for */ no_op = FALSE; -======= - simple_mutex_unlock(mutex); - } /**< for */ - no_op = FALSE; ->>>>>>> MERGE-SOURCE } dcb_process_zombies(thread_id); if (shutdown) diff --git a/server/include/dcb.h b/server/include/dcb.h index 332bfbf4b..f55fdb9d0 100644 --- a/server/include/dcb.h +++ b/server/include/dcb.h @@ -134,7 +134,6 @@ typedef struct { * gateway may be selected to execute the required actions when a network event occurs. */ typedef struct dcb { - simple_mutex_t mutex; /**< Protects dcb processing. Coarse and temporary? */ int fd; /**< The descriptor */ int state; /**< Current descriptor state */ char *remote; /**< Address of remote end */ diff --git a/server/modules/protocol/mysql_client.c b/server/modules/protocol/mysql_client.c index ffda41262..b12f63e8e 100644 --- a/server/modules/protocol/mysql_client.c +++ b/server/modules/protocol/mysql_client.c @@ -488,7 +488,6 @@ int gw_read_client_event(DCB* dcb) { ROUTER_OBJECT *router = NULL; ROUTER *router_instance = NULL; void *rsession = NULL; -<<<<<<< TREE MySQLProtocol *protocol = NULL; int b = -1; @@ -501,52 +500,26 @@ int gw_read_client_event(DCB* dcb) { spinlock_release(&dcb->writeqlock); return 1; } -======= - MySQLProtocol *protocol = NULL; - int b = -1; ->>>>>>> MERGE-SOURCE if (dcb) { - protocol = DCB_PROTOCOL(dcb, MySQLProtocol); + protocol = DCB_PROTOCOL(dcb, MySQLProtocol); } - + if (ioctl(dcb->fd, FIONREAD, &b)) { -<<<<<<< TREE - int eno = errno; - errno = 0; - skygw_log_write( - LOGFILE_ERROR, - "%lu [gw_read_client_event] Setting FIONREAD for fd " - "%d failed. errno %d, %s. dcb->state = %d", - pthread_self(), - dcb->fd, - eno, - strerror(eno), - dcb->state); - - spinlock_release(&dcb->writeqlock); - return 1; -======= - int eno = errno; - errno = 0; - skygw_log_write( - LOGFILE_ERROR, - "%lu [gw_read_client_event] Setting FIONREAD for %d failed. " - "errno %d, %s", - pthread_self(), - dcb->fd, - eno , - strerror(eno)); - skygw_log_write( - LOGFILE_TRACE, - "%lu [gw_read_client_event] Setting FIONREAD for %d failed. " - "errno %d, %s", - pthread_self(), - dcb->fd, - eno , - strerror(eno)); - return 1; ->>>>>>> MERGE-SOURCE + int eno = errno; + errno = 0; + skygw_log_write( + LOGFILE_ERROR, + "%lu [gw_read_client_event] Setting FIONREAD for fd " + "%d failed. errno %d, %s. dcb->state = %d", + pthread_self(), + dcb->fd, + eno, + strerror(eno), + dcb->state); + + spinlock_release(&dcb->writeqlock); + return 1; } else { //fprintf(stderr, "Client IOCTL FIONREAD bytes to read = %i\n", b); }