Commit 1e91f015 authored by unknown's avatar unknown

Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb


ndb/src/mgmsrv/Services.cpp:
  Auto merged
configure.in:
  Auto merged
acinclude.m4:
  Auto merged
parents f7e31ee9 6b20f46a
# Local macros for automake & autoconf
AC_DEFUN(MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY,[
AC_CACHE_CHECK([HIST_ENTRY is declared in readline/readline.h], mysql_cv_hist_entry_declared,
AC_TRY_COMPILE(
[
#include "stdio.h"
#undef __P // readline-4.2 declares own __P
#include "readline/readline.h"
],
[
HIST_ENTRY entry;
],
[
mysql_cv_hist_entry_declared=yes
AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, [1],
[HIST_ENTRY is defined in the outer libeditreadline])
],
[mysql_cv_libedit_interface=no]
)
)
])
AC_DEFUN(MYSQL_CHECK_LIBEDIT_INTERFACE,[
AC_CACHE_CHECK([libedit variant of rl_completion_entry_function], mysql_cv_libedit_interface,
AC_TRY_COMPILE(
[
#include "stdio.h"
#undef __P // readline-4.2 declares own __P
#include "readline/readline.h"
],
[
......@@ -26,6 +49,7 @@ AC_DEFUN(MYSQL_CHECK_NEW_RL_INTERFACE,[
AC_TRY_COMPILE(
[
#include "stdio.h"
#undef __P // readline-4.2 declares own __P
#include "readline/readline.h"
],
[
......
......@@ -84,6 +84,7 @@ extern "C" {
#if defined( __WIN__) || defined(OS2)
#include <conio.h>
#elif !defined(__NETWARE__)
#undef __P // readline-4.2 declares own __P
#include <readline/readline.h>
#define HAVE_READLINE
#endif
......@@ -294,7 +295,7 @@ static const char *server_default_groups[]=
HIST_ENTRY is defined for libedit, but not for the real readline
Need to redefine it for real readline to find it
*/
#if !defined(USE_LIBEDIT_INTERFACE)
#if !defined(HAVE_HIST_ENTRY)
typedef struct _hist_entry {
const char *line;
const char *data;
......@@ -753,8 +754,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1;
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) ==
~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -249,7 +249,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -633,8 +633,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) ==
~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V': print_version(); exit(0);
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -582,8 +582,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
case (int) OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol= find_type(argument, &sql_protocol_typelib, 0))
== ~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -203,7 +203,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
......@@ -268,7 +268,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
{
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
......
# Copyright (C) 2004 MySQL AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
## Process this file with automake to create Makefile.in
SUBDIRS= @readline_basedir@
......
......@@ -2301,6 +2301,20 @@ AC_ARG_WITH(libedit,
[ with_libedit=undefined ]
)
#
# We support next variants of compilation:
# --with-readline
# | yes | no | undefined
# --with-libedit | | |
# ---------------+----------------+------+----------------------------------
# yes | ERROR! | use libedit from mysql sources
# ---------------+----------------+------+----------------------------------
# no | use readline | use system readline or external libedit
# | from mysql | according to results of m4 tests
# ---------------+ sources (if it + +----------------------------------
# undefined | is presented) | | use libedit from mysql sources
compile_readline="no"
compile_libedit="no"
......@@ -2328,6 +2342,7 @@ then
readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a"
readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/libedit/readline readline"
compile_libedit=yes
AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY)
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
elif test "$with_readline" = "yes"
then
......@@ -2339,8 +2354,12 @@ then
compile_readline=yes
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
else
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
MYSQL_CHECK_LIBEDIT_INTERFACE
MYSQL_CHECK_NEW_RL_INTERFACE
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
AC_LANG_RESTORE
if [test "$mysql_cv_new_rl_interface" = "yes"] || [test "$mysql_cv_libedit_interface" = "no"]
then
readline_link="-lreadline"
......
<default>
ok
TCP
ok
SOCKET
ok
ERROR 2047: Wrong or unknown protocol
ERROR 2047: Wrong or unknown protocol
Unknown option to protocol: NullS
# test for Bug #4998 "--protocol doesn't reject bad values"
--exec echo "select ' ok' as '<default>'" | $MYSQL
--exec echo "select ' ok' as 'TCP'" | $MYSQL --protocol=TCP
--exec echo "select ' ok' as 'SOCKET'" | $MYSQL --protocol=SOCKET
--exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1
--exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1
--exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1
......@@ -158,7 +158,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
(flag=mi_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
next_key_length <= 0),
!(nextflag & SEARCH_PREFIX))))
(my_bool)!(nextflag & SEARCH_PREFIX))))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length;
b+=b_length;
......@@ -171,7 +171,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
(flag= mi_compare_text(keyseg->charset, a, a_length, b, b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
next_key_length <= 0),
!(nextflag & SEARCH_PREFIX))))
(my_bool)!(nextflag & SEARCH_PREFIX))))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a=end;
b+=length;
......
......@@ -148,7 +148,7 @@ private:
*/
class Grep : public SimulatedBlock //GrepParticipant
{
//BLOCK_DEFINES(Grep);
BLOCK_DEFINES(Grep);
public:
Grep(const Configuration & conf);
......@@ -519,19 +519,6 @@ public:
typedef void (Grep::* ExecSignalLocal1) (Signal* signal);
typedef void (Grep::PSCoord::* ExecSignalLocal2) (Signal* signal);
typedef void (Grep::PSPart::* ExecSignalLocal4) (Signal* signal);
void
addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal1 f, bool force = false){
addRecSignalImpl(gsn, (ExecFunction)f, force);
}
void
addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal2 f, bool force = false){
addRecSignalImpl(gsn, (ExecFunction)f, force);
}
void
addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal4 f, bool force = false){
addRecSignalImpl(gsn, (ExecFunction)f, force);
}
};
......
......@@ -132,7 +132,7 @@ Grep::~Grep()
{
}
//BLOCK_FUNCTIONS(Grep);
BLOCK_FUNCTIONS(Grep);
Grep::PSPart::PSPart(Grep * sb) :
BlockComponent(sb),
......
......@@ -654,13 +654,21 @@ CommandInterpreter::executeShow(char* parameters)
api_nodes= 0,
mgm_nodes= 0;
for(i=0; i < state->no_of_nodes; i++) {
if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB &&
state->node_states[i].version != 0){
master_id= state->node_states[i].dynamic_id;
break;
}
}
for(i=0; i < state->no_of_nodes; i++) {
switch(state->node_states[i].node_type) {
case NDB_MGM_NODE_TYPE_API:
api_nodes++;
break;
case NDB_MGM_NODE_TYPE_NDB:
if (state->node_states[i].dynamic_id > master_id)
if (state->node_states[i].dynamic_id < master_id)
master_id= state->node_states[i].dynamic_id;
ndb_nodes++;
break;
......
......@@ -2304,7 +2304,7 @@ bool
MgmtSrvr::alloc_node_id(NodeId * nodeId,
enum ndb_mgm_node_type type,
struct sockaddr *client_addr,
socklen_t *client_addr_len)
SOCKET_SIZE_TYPE *client_addr_len)
{
Guard g(&f_node_id_mutex);
#if 0
......@@ -2885,4 +2885,6 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
}
template class Vector<SigMatch>;
#if __SUNPRO_CC != 0x560
template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbApiSignal*&, unsigned);
#endif
......@@ -467,7 +467,7 @@ public:
*/
bool getNextNodeId(NodeId * _nodeId, enum ndb_mgm_node_type type) const ;
bool alloc_node_id(NodeId * _nodeId, enum ndb_mgm_node_type type,
struct sockaddr *client_addr, socklen_t *client_addr_len);
struct sockaddr *client_addr, SOCKET_SIZE_TYPE *client_addr_len);
/**
*
......
......@@ -402,7 +402,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
}
struct sockaddr addr;
socklen_t addrlen= sizeof(addr);
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r = getpeername(m_socket, &addr, &addrlen);
if (r != 0 ) {
m_output->println(cmd);
......
......@@ -37,7 +37,7 @@
NdbEventOperation::NdbEventOperation(Ndb *theNdb,
const char* eventName,
const int bufferLength)
int bufferLength)
: m_impl(* new NdbEventOperationImpl(*this,theNdb,
eventName,
bufferLength))
......
......@@ -778,7 +778,8 @@ main(void){
#endif
template class Vector<NdbScanFilterImpl::State>;
#if __SUNPRO_CC != 0x560
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint32);
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint64);
#endif
......@@ -161,7 +161,9 @@ private:
/**
* Block number handling
*/
public:
static const unsigned MAX_NO_THREADS = 4711;
private:
struct ThreadData {
static const Uint32 ACTIVE = (1 << 16) | 1;
......
......@@ -386,6 +386,7 @@ sync_down(NDBT_Context* ctx){
if(threads){
ctx->decProperty("PauseThreads");
}
return 0;
}
int
......@@ -397,6 +398,7 @@ sync_up_and_wait(NDBT_Context* ctx){
if(threads){
ndbout_c("wait completed");
}
return 0;
}
int
......
......@@ -1058,9 +1058,8 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->max_allowed_packet= atoi(opt_arg);
break;
case 28: /* protocol */
if ((options->protocol = find_type(opt_arg,
&sql_protocol_typelib,0))
== ~(ulong) 0)
if ((options->protocol= find_type(opt_arg,
&sql_protocol_typelib,0)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
exit(1);
......
......@@ -1423,7 +1423,8 @@ int ha_ndbcluster::write_row(byte *record)
{
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
DBUG_PRINT("info",
("Trying to set next auto increment value to %u", next_val));
("Trying to set next auto increment value to %lu",
(ulong) next_val));
if (m_ndb->setAutoIncrementValue((NDBTAB *) m_table, next_val, true))
DBUG_PRINT("info",
("Setting next auto increment value to %u", next_val));
......
......@@ -919,7 +919,7 @@ double Item_param::val()
This works for example when user says SELECT ?+0.0 and supplies
time value for the placeholder.
*/
return (double) TIME_to_ulonglong(&value.time);
return ulonglong2double(TIME_to_ulonglong(&value.time));
case NULL_VALUE:
return 0.0;
default:
......
......@@ -787,7 +787,7 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
LINT_INIT(old_message);
(void) pthread_mutex_lock(&LOCK_open);
if (need_exit_cond= must_wait)
if ((need_exit_cond= must_wait))
{
if (thd->global_read_lock) // This thread had the read locks
{
......@@ -805,7 +805,11 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
}
if (!abort_on_refresh && !result)
protect_against_global_read_lock++;
if (unlikely(need_exit_cond)) // global read locks are rare
/*
The following is only true in case of a global read locks (which is rare)
and if old_message is set
*/
if (unlikely(need_exit_cond))
thd->exit_cond(old_message);
else
pthread_mutex_unlock(&LOCK_open);
......
This diff is collapsed.
......@@ -155,11 +155,13 @@ bool foreign_key_prefix(Key *a, Key *b)
** Thread specific functions
****************************************************************************/
THD::THD():user_time(0), current_arena(this), is_fatal_error(0),
last_insert_id_used(0),
insert_id_used(0), rand_used(0), time_zone_used(0),
in_lock_tables(0), global_read_lock(0), bootstrap(0)
THD::THD()
:user_time(0), global_read_lock(0), is_fatal_error(0),
last_insert_id_used(0),
insert_id_used(0), rand_used(0), time_zone_used(0),
in_lock_tables(0), bootstrap(0)
{
current_arena= this;
host= user= priv_user= db= ip=0;
host_or_ip= "connecting host";
locked=some_tables_deleted=no_errors=password= 0;
......@@ -439,10 +441,13 @@ void THD::awake(bool prepare_to_die)
it is the true value but maybe current_mutex is not yet non-zero (we're
in the middle of enter_cond() and there is a "memory order
inversion"). So we test the mutex too to not lock 0.
Note that there is a small chance we fail to kill. If victim has locked
current_mutex, and hasn't entered enter_cond(), then we don't know it's
going to wait on cond. Then victim goes into its cond "forever" (until
we issue a second KILL). True we have set its thd->killed but it may not
current_mutex, but hasn't yet entered enter_cond() (which means that
current_cond and current_mutex are 0), then the victim will not get
a signal and it may wait "forever" on the cond (until
we issue a second KILL or the status it's waiting for happens).
It's true that we have set its thd->killed but it may not
see it immediately and so may have time to reach the cond_wait().
*/
if (mysys_var->current_cond && mysys_var->current_mutex)
......
......@@ -8014,7 +8014,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
Item *itemptr=*order->item;
if (itemptr->type() == Item::INT_ITEM)
{ /* Order by position */
uint count= itemptr->val_int();
uint count= (uint) itemptr->val_int();
if (!count || count > fields.elements)
{
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),
......
......@@ -3281,7 +3281,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ha_rows *deleted)
{
int error;
Copy_field *copy,*copy_end, *next_field= 0;
Copy_field *copy,*copy_end;
ulong found_count,delete_count;
THD *thd= current_thd;
uint length;
......@@ -3291,6 +3291,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
List<Item> fields;
List<Item> all_fields;
ha_rows examined_rows;
bool auto_increment_field_copied= 0;
DBUG_ENTER("copy_data_between_tables");
if (!(copy= new Copy_field[to->fields]))
......@@ -3309,7 +3310,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (def->field)
{
if (*ptr == to->next_number_field)
next_field= copy_end;
auto_increment_field_copied= TRUE;
(copy_end++)->set(*ptr,def->field,0);
}
......@@ -3368,11 +3369,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
}
thd->row_count++;
if (to->next_number_field)
to->next_number_field->reset();
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
{
if (copy_ptr == next_field)
if (auto_increment_field_copied)
to->auto_increment_field_not_null= TRUE;
else
to->next_number_field->reset();
}
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
{
copy_ptr->do_copy(copy_ptr);
}
if ((error=to->file->write_row((byte*) to->record[0])))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment