From: Christopher Powers Date: August 11 2011 4:12pm Subject: bzr push into mysql-trunk branch (chris.powers:3363 to 3364) WL#4896 List-Archive: http://lists.mysql.com/commits/140601 Message-Id: <201108111612.p7BGCW6k007844@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3364 Christopher Powers 2011-08-11 WL#4896 "Performance Schema Net IO" - Solaris build break: Removed DOS line endings from macro MYSQL_SOCKET_SET_STATE - Removed tabs chars from recently updated files, pfs.cc and net_serv.cc @ include/mysql/psi/mysql_socket.h Removed DOS line endings @ sql/net_serv.cc Removed tabs @ storage/perfschema/pfs.cc Removed tabs modified: include/mysql/psi/mysql_socket.h sql/net_serv.cc storage/perfschema/pfs.cc 3363 Christopher Powers 2011-08-11 WL#4896 "Performance Schem Net IO" Fix Solaris build break--duplicate macro definition modified: include/mysql/psi/mysql_socket.h === modified file 'include/mysql/psi/mysql_socket.h' --- a/include/mysql/psi/mysql_socket.h 2011-08-11 07:20:03 +0000 +++ b/include/mysql/psi/mysql_socket.h 2011-08-11 16:07:45 +0000 @@ -202,13 +202,13 @@ mysql_socket_setfd(MYSQL_SOCKET *mysql_s do {} while (0) #endif -#ifdef HAVE_PSI_SOCKET_INTERFACE - #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ - inline_mysql_socket_set_state(SOCKET, STATE) -#else - #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ - do {} while (0) -#endif +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ + inline_mysql_socket_set_state(SOCKET, STATE) +#else + #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ + do {} while (0) +#endif #ifdef HAVE_PSI_SOCKET_INTERFACE /** @@ -537,7 +537,7 @@ inline_mysql_socket_socket #ifdef HAVE_PSI_SOCKET_INTERFACE mysql_socket.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd); - + if (likely(mysql_socket.fd != INVALID_SOCKET && mysql_socket.m_psi != NULL)) PSI_CALL(set_socket_info)(mysql_socket.m_psi, &mysql_socket.fd, NULL, 0); #endif === modified file 'sql/net_serv.cc' --- a/sql/net_serv.cc 2011-08-10 23:35:12 +0000 +++ b/sql/net_serv.cc 2011-08-11 16:07:45 +0000 @@ -93,8 +93,8 @@ my_bool my_net_init(NET *net, Vio* vio) net->vio = vio; my_net_local_init(net); /* Set some limits */ if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+ - NET_HEADER_SIZE + COMP_HEADER_SIZE, - MYF(MY_WME)))) + NET_HEADER_SIZE + COMP_HEADER_SIZE, + MYF(MY_WME)))) DBUG_RETURN(1); net->buff_end=net->buff+net->max_packet; net->error=0; net->return_status=0; @@ -287,7 +287,7 @@ my_bool my_net_write(NET *net, const uch int3store(buff, z_size); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net, buff, NET_HEADER_SIZE) || - net_write_buff(net, packet, z_size)) + net_write_buff(net, packet, z_size)) { MYSQL_NET_WRITE_DONE(1); return 1; @@ -341,8 +341,8 @@ my_bool my_net_write(NET *net, const uch my_bool net_write_command(NET *net,uchar command, - const uchar *header, size_t head_len, - const uchar *packet, size_t len) + const uchar *header, size_t head_len, + const uchar *packet, size_t len) { size_t length=len+1+head_len; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; @@ -364,11 +364,11 @@ net_write_command(NET *net,uchar command int3store(buff, MAX_PACKET_LENGTH); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net, buff, header_size) || - net_write_buff(net, header, head_len) || - net_write_buff(net, packet, len)) + net_write_buff(net, header, head_len) || + net_write_buff(net, packet, len)) { MYSQL_NET_WRITE_DONE(1); - DBUG_RETURN(1); + DBUG_RETURN(1); } packet+= len; length-= MAX_PACKET_LENGTH; @@ -376,7 +376,7 @@ net_write_command(NET *net,uchar command head_len= 0; header_size= NET_HEADER_SIZE; } while (length >= MAX_PACKET_LENGTH); - len=length; /* Data left to be written */ + len=length; /* Data left to be written */ } int3store(buff,length); buff[3]= (uchar) net->pkt_nr++; @@ -434,7 +434,7 @@ net_write_buff(NET *net, const uchar *pa memcpy(net->write_pos, packet, left_length); if (net_write_packet(net, net->buff, (size_t) (net->write_pos - net->buff) + left_length)) - return 1; + return 1; net->write_pos= net->buff; packet+= left_length; len-= left_length; @@ -442,16 +442,16 @@ net_write_buff(NET *net, const uchar *pa if (net->compress) { /* - We can't have bigger packets than 16M with compression - Because the uncompressed length is stored in 3 bytes + We can't have bigger packets than 16M with compression + Because the uncompressed length is stored in 3 bytes */ left_length= MAX_PACKET_LENGTH; while (len > left_length) { - if (net_write_packet(net, packet, left_length)) - return 1; - packet+= left_length; - len-= left_length; + if (net_write_packet(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; } } if (len > net->max_packet) @@ -884,12 +884,12 @@ my_net_read(NET *net) size_t total_length= 0; do { - net->where_b += len; - total_length += len; - len= net_read_packet(net, &complen); + net->where_b += len; + total_length += len; + len= net_read_packet(net, &complen); } while (len == MAX_PACKET_LENGTH); if (len != packet_error) - len+= total_length; + len+= total_length; net->where_b = save_pos; } net->read_pos = net->buff + net->where_b; @@ -912,7 +912,7 @@ my_net_read(NET *net) { buf_length= net->buf_length; /* Data left in old packet */ first_packet_offset= start_of_packet= (net->buf_length - - net->remain_in_buf); + net->remain_in_buf); /* Restore the character that was overwritten by the end 0 */ net->buff[start_of_packet]= net->save_char; } @@ -927,72 +927,72 @@ my_net_read(NET *net) if (buf_length - start_of_packet >= NET_HEADER_SIZE) { - read_length = uint3korr(net->buff+start_of_packet); - if (!read_length) - { - /* End of multi-byte packet */ - start_of_packet += NET_HEADER_SIZE; - break; - } - if (read_length + NET_HEADER_SIZE <= buf_length - start_of_packet) - { - if (multi_byte_packet) - { - /* Remove packet header for second packet */ - memmove(net->buff + first_packet_offset + start_of_packet, - net->buff + first_packet_offset + start_of_packet + - NET_HEADER_SIZE, - buf_length - start_of_packet); - start_of_packet += read_length; - buf_length -= NET_HEADER_SIZE; - } - else - start_of_packet+= read_length + NET_HEADER_SIZE; - - if (read_length != MAX_PACKET_LENGTH) /* last package */ - { - multi_byte_packet= 0; /* No last zero len packet */ - break; - } - multi_byte_packet= NET_HEADER_SIZE; - /* Move data down to read next data packet after current one */ - if (first_packet_offset) - { - memmove(net->buff,net->buff+first_packet_offset, - buf_length-first_packet_offset); - buf_length-=first_packet_offset; - start_of_packet -= first_packet_offset; - first_packet_offset=0; - } - continue; - } + read_length = uint3korr(net->buff+start_of_packet); + if (!read_length) + { + /* End of multi-byte packet */ + start_of_packet += NET_HEADER_SIZE; + break; + } + if (read_length + NET_HEADER_SIZE <= buf_length - start_of_packet) + { + if (multi_byte_packet) + { + /* Remove packet header for second packet */ + memmove(net->buff + first_packet_offset + start_of_packet, + net->buff + first_packet_offset + start_of_packet + + NET_HEADER_SIZE, + buf_length - start_of_packet); + start_of_packet += read_length; + buf_length -= NET_HEADER_SIZE; + } + else + start_of_packet+= read_length + NET_HEADER_SIZE; + + if (read_length != MAX_PACKET_LENGTH) /* last package */ + { + multi_byte_packet= 0; /* No last zero len packet */ + break; + } + multi_byte_packet= NET_HEADER_SIZE; + /* Move data down to read next data packet after current one */ + if (first_packet_offset) + { + memmove(net->buff,net->buff+first_packet_offset, + buf_length-first_packet_offset); + buf_length-=first_packet_offset; + start_of_packet -= first_packet_offset; + first_packet_offset=0; + } + continue; + } } /* Move data down to read next data packet after current one */ if (first_packet_offset) { - memmove(net->buff,net->buff+first_packet_offset, - buf_length-first_packet_offset); - buf_length-=first_packet_offset; - start_of_packet -= first_packet_offset; - first_packet_offset=0; + memmove(net->buff,net->buff+first_packet_offset, + buf_length-first_packet_offset); + buf_length-=first_packet_offset; + start_of_packet -= first_packet_offset; + first_packet_offset=0; } net->where_b=buf_length; if ((packet_len= net_read_packet(net, &complen)) == packet_error) { MYSQL_NET_READ_DONE(1, 0); - return packet_error; + return packet_error; } if (my_uncompress(net->buff + net->where_b, packet_len, - &complen)) + &complen)) { - net->error= 2; /* caller will close socket */ + net->error= 2; /* caller will close socket */ net->last_errno= ER_NET_UNCOMPRESS_ERROR; #ifdef MYSQL_SERVER - my_error(ER_NET_UNCOMPRESS_ERROR, MYF(0)); + my_error(ER_NET_UNCOMPRESS_ERROR, MYF(0)); #endif MYSQL_NET_READ_DONE(1, 0); - return packet_error; + return packet_error; } buf_length+= complen; } === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2011-08-11 03:11:58 +0000 +++ b/storage/perfschema/pfs.cc 2011-08-11 16:07:45 +0000 @@ -2857,7 +2857,7 @@ get_thread_socket_locker_v1(PSI_socket_l flags= STATE_FLAG_THREAD; /* Sockets in IDLE state are timed separately */ - if (pfs_socket->m_timed) + if (pfs_socket->m_timed) flags|= STATE_FLAG_TIMED; if (flag_events_waits_current) @@ -2892,7 +2892,7 @@ get_thread_socket_locker_v1(PSI_socket_l else { /* Sockets in IDLE state are counted but not timed */ - if (pfs_socket->m_timed) + if (pfs_socket->m_timed) { flags= STATE_FLAG_TIMED; } @@ -2902,7 +2902,7 @@ get_thread_socket_locker_v1(PSI_socket_l /* Even if timing is disabled, end_socket_wait() still needs a locker to - capture the number of bytes sent or received by the socket operation. + capture the number of bytes sent or received by the socket operation. For operations that do not have a byte count, then just increment the event counter and return a NULL locker. */ No bundle (reason: useless for push emails).