forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleg Tsarev
committed
Dec 9, 2010
1 parent
372be1e
commit fb0ba5f
Showing
119 changed files
with
13,799 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Portions of this software contain modifications contributed by Eric Bergen. | ||
These contributions are used with the following license: | ||
|
||
Copyright (c) 2010, Eric Bergen. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
* Neither the name of the Eric Bergen. nor the names of its | ||
contributors may be used to endorse or promote products | ||
derived from this software without specific prior written | ||
permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Portions of this software contain modifications contributed by Venu Anuganti. | ||
These contributions are used with the following license: | ||
|
||
Copyright (c) 2010, Venu Anuganti, http://venublog.com/ | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FETCH_CMD=wget | ||
MASTER_SITE=http://www.percona.com/downloads/community | ||
MYSQL_VERSION=5.5.7-rc | ||
PERCONA_SERVER ?=Percona-Server | ||
DEBUG_DIR ?= $(PERCONA_SERVER)-debug | ||
RELEASE_DIR ?= $(PERCONA_SERVER)-release | ||
CMAKE=CFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2" CXXFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2" cmake | ||
|
||
all: main install-lic tests misc | ||
@echo "" | ||
@echo "Percona Server source code is ready" | ||
@echo "Now change directory to $(PERCONA_SERVER) define variables as show below" | ||
@echo "" | ||
export CFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2" | ||
export CXXFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2" | ||
export LIBS=-lrt | ||
@echo "" | ||
@echo "and run ./configure ... --without-plugin-innobase --with-plugin-innodb_plugin && make all install" | ||
@echo "" | ||
|
||
cmake: | ||
rm -rf $(DEBUG_DIR) | ||
rm -rf $(RELEASE_DIR) | ||
(mkdir -p $(DEBUG_DIR); cd $(DEBUG_DIR); $(CMAKE) -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DWITH_DEBUG=Full ../$(PERCONA_SERVER)) | ||
(mkdir -p $(RELEASE_DIR); cd $(RELEASE_DIR); $(CMAKE) -G "Unix Makefiles" ../$(PERCONA_SERVER)) | ||
|
||
install-lic: | ||
@echo "Installing license files" | ||
install -m 644 COPYING.* $(PERCONA_SERVER) | ||
|
||
main: mysql-$(MYSQL_VERSION).tar.gz | ||
@echo "Prepare Percona Server sources" | ||
rm -rf mysql-$(MYSQL_VERSION) | ||
rm -rf $(PERCONA_SERVER); | ||
tar zxf mysql-$(MYSQL_VERSION).tar.gz | ||
mv mysql-$(MYSQL_VERSION) $(PERCONA_SERVER) | ||
(cat `cat series`) | patch -p1 -d $(PERCONA_SERVER) | ||
rm $(PERCONA_SERVER)/sql/sql_yacc.cc $(PERCONA_SERVER)/sql/sql_yacc.h | ||
|
||
mysql-$(MYSQL_VERSION).tar.gz: | ||
@echo "Downloading MySQL sources from $(MASTER_SITE)" | ||
$(FETCH_CMD) $(MASTER_SITE)/mysql-$(MYSQL_VERSION).tar.gz | ||
|
||
tests: | ||
./install_tests.sh | ||
|
||
misc: | ||
@echo "Installing other files" | ||
install -m 644 lrusort.py $(PERCONA_SERVER)/scripts | ||
|
||
clean: env | ||
rm -rf mysql-$(MYSQL_VERSION) $(PERCONA_SERVER) | ||
rm -f mysql-$(MYSQL_VERSION).tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# name : bug580324.patch | ||
# introduced : 11 or before | ||
# maintainer : Oleg | ||
# | ||
#!!! notice !!! | ||
# Any small change to this file in the main branch | ||
# should be done or reviewed by the maintainer! | ||
diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc | ||
--- a/sql/sql_base.cc 2010-05-27 19:54:18.000000000 +0400 | ||
+++ b/sql/sql_base.cc 2010-05-27 19:55:20.000000000 +0400 | ||
@@ -233,8 +233,12 @@ | ||
uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, | ||
bool tmp_table) | ||
{ | ||
- uint key_length= (uint) (strmov(strmov(key, table_list->db)+1, | ||
- table_list->table_name)-key)+1; | ||
+ char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2); | ||
+ *db_end++= '\0'; | ||
+ char *table_end= strnmov(db_end, table_list->table_name, | ||
+ key + MAX_DBKEY_LENGTH - 1 - db_end); | ||
+ *table_end++= '\0'; | ||
+ uint key_length= (uint) (table_end-key); | ||
if (tmp_table) | ||
{ | ||
int4store(key + key_length, thd->server_id); | ||
diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc | ||
--- a/sql/sql_parse.cc 2010-05-27 19:54:18.000000000 +0400 | ||
+++ b/sql/sql_parse.cc 2010-05-27 20:03:20.000000000 +0400 | ||
@@ -1326,10 +1326,12 @@ | ||
break; | ||
#else | ||
{ | ||
- char *fields, *packet_end= packet + packet_length, *arg_end; | ||
+ char *fields, *packet_end= packet + packet_length, *wildcard; | ||
/* Locked closure of all tables */ | ||
TABLE_LIST table_list; | ||
- LEX_STRING conv_name; | ||
+ char db_buff[NAME_LEN+1]; | ||
+ uint32 db_length; | ||
+ uint dummy_errors; | ||
|
||
/* used as fields initializator */ | ||
lex_start(thd); | ||
@@ -1341,26 +1343,22 @@ | ||
/* | ||
We have name + wildcard in packet, separated by endzero | ||
*/ | ||
- arg_end= strend(packet); | ||
- uint arg_length= arg_end - packet; | ||
- | ||
- /* Check given table name length. */ | ||
- if (arg_length >= packet_length || arg_length > NAME_LEN) | ||
+ wildcard= strend(packet); | ||
+ db_length= wildcard - packet; | ||
+ wildcard++; | ||
+ uint query_length= (uint) (packet_end - wildcard); // Don't count end \0 | ||
+ if (db_length > NAME_LEN || query_length > NAME_LEN) | ||
{ | ||
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0)); | ||
break; | ||
} | ||
- thd->convert_string(&conv_name, system_charset_info, | ||
- packet, arg_length, thd->charset()); | ||
- if (check_table_name(conv_name.str, conv_name.length, FALSE)) | ||
- { | ||
- /* this is OK due to convert_string() null-terminating the string */ | ||
- my_error(ER_WRONG_TABLE_NAME, MYF(0), conv_name.str); | ||
+ db_length= copy_and_convert(db_buff, sizeof(db_buff)-1, | ||
+ system_charset_info, packet, db_length, | ||
+ thd->charset(), &dummy_errors); | ||
+ db_buff[db_length]= '\0'; | ||
+ table_list.alias= table_list.table_name= db_buff; | ||
+ if (!(fields= (char *) thd->memdup(wildcard, query_length + 1))) | ||
break; | ||
- } | ||
- | ||
- table_list.alias= table_list.table_name= conv_name.str; | ||
- packet= arg_end + 1; | ||
|
||
if (is_schema_db(table_list.db, table_list.db_length)) | ||
{ | ||
@@ -1369,9 +1367,6 @@ | ||
table_list.schema_table= schema_table; | ||
} | ||
|
||
- uint query_length= (uint) (packet_end - packet); // Don't count end \0 | ||
- if (!(fields= (char *) thd->memdup(packet, query_length + 1))) | ||
- break; | ||
thd->set_query(fields, query_length); | ||
general_log_print(thd, command, "%s %s", table_list.table_name, fields); | ||
if (lower_case_table_names) | ||
diff -ruN a/strings/ctype-utf8.c b/strings/ctype-utf8.c | ||
--- a/strings/ctype-utf8.c 2010-05-06 19:28:05.000000000 +0400 | ||
+++ b/strings/ctype-utf8.c 2010-05-27 20:04:20.000000000 +0400 | ||
@@ -4116,6 +4116,10 @@ | ||
{ | ||
int code; | ||
char hex[]= "0123456789abcdef"; | ||
+ | ||
+ if (s >= e) | ||
+ return MY_CS_TOOSMALL; | ||
+ | ||
if (wc < 128 && filename_safe_char[wc]) | ||
{ | ||
*s= (uchar) wc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
# name : bugfix48929.patch | ||
# introduced : 11 or before | ||
# maintainer : Oleg | ||
# | ||
#!!! notice !!! | ||
# Any small change to this file in the main branch | ||
# should be done or reviewed by the maintainer! | ||
diff -ruN a/configure.in b/configure.in | ||
--- a/configure.in 2010-07-07 03:33:05.008972002 +0400 | ||
+++ b/configure.in 2010-07-07 03:33:05.788972002 +0400 | ||
@@ -808,7 +808,7 @@ | ||
AC_HEADER_STDC | ||
AC_HEADER_SYS_WAIT | ||
AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \ | ||
- ieeefp.h limits.h memory.h pwd.h select.h \ | ||
+ ieeefp.h limits.h memory.h pwd.h select.h poll.h \ | ||
stdlib.h stddef.h \ | ||
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \ | ||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ | ||
diff -ruN a/configure b/configure | ||
--- a/configure 2010-07-26 18:29:12.172114128 +0900 | ||
+++ b/configure 2010-07-26 20:44:59.199030524 +0900 | ||
@@ -21524,7 +21524,7 @@ | ||
|
||
|
||
for ac_header in fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \ | ||
- ieeefp.h limits.h memory.h pwd.h select.h \ | ||
+ ieeefp.h limits.h memory.h pwd.h select.h poll.h \ | ||
stdlib.h stddef.h \ | ||
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \ | ||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ | ||
diff -ruN a/include/config.h.in b/include/config.h.in | ||
--- a/include/config.h.in 2010-07-26 18:29:12.192113524 +0900 | ||
+++ b/include/config.h.in 2010-07-26 20:46:08.265182869 +0900 | ||
@@ -599,6 +599,9 @@ | ||
/* Define to 1 if you have the `poll' function. */ | ||
#undef HAVE_POLL | ||
|
||
+/* Define to 1 if you have the <poll.h> header file. */ | ||
+#undef HAVE_POLL_H | ||
+ | ||
/* Define to 1 if you have the `port_create' function. */ | ||
#undef HAVE_PORT_CREATE | ||
|
||
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc | ||
--- a/sql/mysqld.cc 2010-07-07 03:33:05.278972002 +0400 | ||
+++ b/sql/mysqld.cc 2010-07-07 03:33:05.788972002 +0400 | ||
@@ -55,6 +55,10 @@ | ||
#include "sp_rcontext.h" | ||
#include "sp_cache.h" | ||
|
||
+#ifdef HAVE_POLL_H | ||
+#include <poll.h> | ||
+#endif | ||
+ | ||
#define mysqld_charset &my_charset_latin1 | ||
|
||
#ifdef HAVE_purify | ||
@@ -5108,28 +5112,49 @@ | ||
{ | ||
my_socket sock,new_sock; | ||
uint error_count=0; | ||
- uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); | ||
- fd_set readFDs,clientFDs; | ||
THD *thd; | ||
struct sockaddr_in cAddr; | ||
- int ip_flags=0,socket_flags=0,flags; | ||
+ int ip_flags=0,socket_flags=0,flags,retval; | ||
st_vio *vio_tmp; | ||
+#ifdef HAVE_POLL | ||
+ int socket_count= 0; | ||
+ struct pollfd fds[2]; // for ip_sock and unix_sock | ||
+#else | ||
+ fd_set readFDs,clientFDs; | ||
+ uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); | ||
+#endif | ||
+ | ||
DBUG_ENTER("handle_connections_sockets"); | ||
|
||
LINT_INIT(new_sock); | ||
|
||
(void) my_pthread_getprio(pthread_self()); // For debugging | ||
|
||
+#ifndef HAVE_POLL | ||
FD_ZERO(&clientFDs); | ||
+#endif | ||
+ | ||
if (ip_sock != INVALID_SOCKET) | ||
{ | ||
+#ifdef HAVE_POLL | ||
+ fds[socket_count].fd= ip_sock; | ||
+ fds[socket_count].events= POLLIN; | ||
+ socket_count++; | ||
+#else | ||
FD_SET(ip_sock,&clientFDs); | ||
+#endif | ||
#ifdef HAVE_FCNTL | ||
ip_flags = fcntl(ip_sock, F_GETFL, 0); | ||
#endif | ||
} | ||
#ifdef HAVE_SYS_UN_H | ||
+#ifdef HAVE_POLL | ||
+ fds[socket_count].fd= unix_sock; | ||
+ fds[socket_count].events= POLLIN; | ||
+ socket_count++; | ||
+#else | ||
FD_SET(unix_sock,&clientFDs); | ||
+#endif | ||
#ifdef HAVE_FCNTL | ||
socket_flags=fcntl(unix_sock, F_GETFL, 0); | ||
#endif | ||
@@ -5139,12 +5164,15 @@ | ||
MAYBE_BROKEN_SYSCALL; | ||
while (!abort_loop) | ||
{ | ||
- readFDs=clientFDs; | ||
-#ifdef HPUX10 | ||
- if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0) | ||
- continue; | ||
+#ifdef HAVE_POLL | ||
+ retval= poll(fds, socket_count, -1); | ||
#else | ||
- if (select((int) max_used_connection,&readFDs,0,0,0) < 0) | ||
+ readFDs=clientFDs; | ||
+ | ||
+ retval= select((int) max_used_connection,&readFDs,0,0,0); | ||
+#endif | ||
+ | ||
+ if (retval < 0) | ||
{ | ||
if (socket_errno != SOCKET_EINTR) | ||
{ | ||
@@ -5154,7 +5182,7 @@ | ||
MAYBE_BROKEN_SYSCALL | ||
continue; | ||
} | ||
-#endif /* HPUX10 */ | ||
+ | ||
if (abort_loop) | ||
{ | ||
MAYBE_BROKEN_SYSCALL; | ||
@@ -5162,6 +5190,21 @@ | ||
} | ||
|
||
/* Is this a new connection request ? */ | ||
+#ifdef HAVE_POLL | ||
+ for (int i= 0; i < socket_count; ++i) | ||
+ { | ||
+ if (fds[i].revents & POLLIN) | ||
+ { | ||
+ sock= fds[i].fd; | ||
+#ifdef HAVE_FCNTL | ||
+ flags= fcntl(sock, F_GETFL, 0); | ||
+#else | ||
+ flags= 0; | ||
+#endif // HAVE_FCNTL | ||
+ break; | ||
+ } | ||
+ } | ||
+#else // HAVE_POLL | ||
#ifdef HAVE_SYS_UN_H | ||
if (FD_ISSET(unix_sock,&readFDs)) | ||
{ | ||
@@ -5169,11 +5212,12 @@ | ||
flags= socket_flags; | ||
} | ||
else | ||
-#endif | ||
+#endif // HAVE_SYS_UN_H | ||
{ | ||
sock = ip_sock; | ||
flags= ip_flags; | ||
} | ||
+#endif // HAVE_POOL | ||
|
||
#if !defined(NO_FCNTL_NONBLOCK) | ||
if (!(test_flags & TEST_BLOCKING)) |
Oops, something went wrong.