Commit 6b464d84 authored by unknown's avatar unknown

Merge work:/home/bk/mysql

into mysql.sashanet.com:/home/sasha/src/bk/mysql

parents 9b55716a 494a3a0f
*.a
*.bb
*.bbg
*.core
*.da
*.gcov
*.la
*.lo
*.o
......@@ -10,13 +14,18 @@
.gdb_history
.libs
.o
db-*.*.*
.out
.snprj/*
BitKeeper/etc/config
BitKeeper/etc/csets
BitKeeper/etc/csets-in
BitKeeper/etc/csets-out
BitKeeper/etc/gone
BitKeeper/etc/level
BitKeeper/etc/pushed
BitKeeper/tmp/*
BitKeeper/tmp/bkr3sAHD
BitKeeper/tmp/gone
COPYING
COPYING.LIB
Docs/INSTALL-BINARY
......@@ -39,6 +48,7 @@ Docs/manual.vr
Docs/manual_a4.ps
Docs/manual_letter.ps
Docs/manual_toc.html
Docs/my_sys.doc
Docs/mysql.info
INSTALL-SOURCE
MIRRORS
......@@ -48,6 +58,39 @@ Makefile.in'
PENDING/*
TAGS
aclocal.m4
bdb/README
bdb/build_unix/*
bdb/build_vxworks/db.h
bdb/build_win32/db.h
bdb/dist/configure
bdb/dist/tags
bdb/dist/template/rec_btree
bdb/dist/template/rec_crdel
bdb/dist/template/rec_db
bdb/dist/template/rec_hash
bdb/dist/template/rec_log
bdb/dist/template/rec_qam
bdb/dist/template/rec_txn
bdb/examples_java
bdb/hash/hash_auto.c
bdb/include/btree_auto.h
bdb/include/crdel_auto.h
bdb/include/db_auto.h
bdb/include/db_server.h
bdb/include/hash_auto.h
bdb/include/log_auto.h
bdb/include/qam_auto.h
bdb/include/txn_auto.h
bdb/java/src/com/sleepycat/db/DbConstants.java
bdb/log/log_auto.c
bdb/qam/qam_auto.c
bdb/rpc_client/db_server_clnt.c
bdb/rpc_client/gen_client.c
bdb/rpc_server/db_server_svc.c
bdb/rpc_server/db_server_xdr.c
bdb/rpc_server/gen_db_server.c
bdb/test/include.tcl
bdb/txn/txn_auto.c
client/insert_test
client/mysql
client/mysqladmin
......@@ -65,12 +108,15 @@ config.log
config.status
configure
core
db-*.*.*
dbug/user.t
extra/comp_err
extra/my_print_defaults
extra/perror
extra/replace
extra/resolve_stack_dump
extra/resolveip
gmon.out
heap/hp_test1
heap/hp_test2
include/my_config.h
......@@ -88,6 +134,7 @@ libmysql/my_static.h
libmysql/mysys_priv.h
libmysql_r/*.c
libmysql_r/acconfig.h
libmysql_r/conf_to_src
libmysql_r/my_static.h
libmysql_r/mysys_priv.h
libtool
......@@ -106,10 +153,16 @@ myisam/mi_test_all
myisam/myisamchk
myisam/myisamlog
myisam/myisampack
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/mysql-test-run
mysql-test/r/*.reject
mysql-test/share/mysql
mysql-test/var/*
mysqld.S
mysqld.sym
mysys/test_charset
mysys/test_dir
mysys/test_thr_alarm
mysys/test_thr_lock
mysys/testhash
......@@ -134,10 +187,12 @@ scripts/mysqld_multi
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/safe_mysqld
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
sql-bench/bench-init.pl
sql-bench/compare-results
sql-bench/copy-db
sql-bench/crash-me
sql-bench/output/*
sql-bench/run-all-tests
sql-bench/server-cfg
sql-bench/test-ATIS
......@@ -148,11 +203,16 @@ sql-bench/test-create
sql-bench/test-insert
sql-bench/test-select
sql-bench/test-wisconsin
sql/.gdbinit
sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
sql/mini_client_errors.c
sql/mysqlbinlog
sql/mysqld
sql/share/*.sys
sql/share/charsets/gmon.out
sql/share/gmon.out
sql/share/norwegian-ny/errmsg.sys
sql/share/norwegian/errmsg.sys
sql/sql_yacc.cc
......@@ -175,63 +235,4 @@ support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
tags
libmysql_r/conf_to_src
mysql-test/install_test_db
mysql-test/mysql-test-run
BitKeeper/tmp/gone
mysqld.S
mysqld.sym
.snprj/*
sql-bench/output/*
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
Docs/my_sys.doc
tmp/*
extra/resolve_stack_dump
sql/share/*.sys
BitKeeper/tmp/bkr3sAHD
BitKeeper/tmp/*
bdb/examples_java
bdb/README
bdb/build_vxworks/db.h
bdb/build_win32/db.h
bdb/dist/configure
bdb/dist/tags
bdb/build_unix/*
sql/.gdbinit
BitKeeper/etc/level
*.gcov
*.bb
*.bbg
*.da
.out
bdb/dist/template/rec_btree
bdb/dist/template/rec_crdel
bdb/dist/template/rec_db
bdb/dist/template/rec_hash
bdb/dist/template/rec_log
bdb/dist/template/rec_qam
bdb/dist/template/rec_txn
bdb/hash/hash_auto.c
bdb/include/btree_auto.h
bdb/include/crdel_auto.h
bdb/include/db_auto.h
bdb/include/db_server.h
bdb/include/hash_auto.h
bdb/include/log_auto.h
bdb/include/qam_auto.h
bdb/include/txn_auto.h
bdb/java/src/com/sleepycat/db/DbConstants.java
bdb/log/log_auto.c
bdb/qam/qam_auto.c
bdb/rpc_client/db_server_clnt.c
bdb/rpc_client/gen_client.c
bdb/rpc_server/db_server_svc.c
bdb/rpc_server/db_server_xdr.c
bdb/rpc_server/gen_db_server.c
bdb/test/include.tcl
bdb/txn/txn_auto.c
gmon.out
mysql-test/gmon.out
sql/gmon.out
sql/share/charsets/gmon.out
sql/share/gmon.out
sasha@mysql.sashanet.com
monty@donna.mysql.fi
......@@ -27391,8 +27391,22 @@ master-slave relationship with @code{log-slave-updates} enabled.
Note, however, that many queries will not work right in this kind of
setup unless your client code is written to take care of the potential
problems that can happen from updates that occur in different sequence
on different servers. Note that the log format has changed in Version 3.23.26
so that pre-3.23.26 slaves will not be able to read it.
on different servers.
This means that you can do a setup like the following:
@example
A -> B -> C -> A
@end example
This setup will only works if you only do non conflicting updates
between the tables. In other words, if you insert data in A and C, you
should never insert a row in A that may have a conflicting key with a
row insert in C. You should also not update the sam rows on two servers
if the order in which the updates are applied matters.
Note that the log format has changed in Version 3.23.26 so that
pre-3.23.26 slaves will not be able to read it.
@item
If the query on the slave gets an error, the slave thread will
terminate, and a message will appear in the @code{.err} file. You should
......@@ -28847,9 +28861,11 @@ explicitely lock the table with @code{LOCK TABLES} or execute a command that
will modify every row in the table, like @code{ALTER TABLE}.
In @strong{MySQL} Version 3.23.7 and above, you can insert rows into
@code{MyISAM} tables at the same time other threads are reading from
the table. Note that currently this only works if there are no holes after
deleted rows in the table at the time the insert is made.
@code{MyISAM} tables at the same time other threads are reading from the
table. Note that currently this only works if there are no holes after
deleted rows in the table at the time the insert is made. When all holes
has been filled with new data, concurrent inserts will automaticly be
enabled again.
Table locking enables many threads to read from a table at the same
time, but if a thread wants to write to a table, it must first get
......@@ -42743,6 +42759,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.37
@itemize @bullet
@item
@code{UPDATE} and @code{DELETE} with @code{WHERE unique_key_part IS NULL}
didn't update/delete all rows.
@item
Disabled @code{INSERT DELAYED} for tables that supports transactions.
@item
Fixed bug when using date functions on @code{TEXT}/@code{BLOB} column
......@@ -92,3 +92,31 @@ NULL 9 0
NULL 9 0
a b c
6 6 0
table type possible_keys key key_len ref rows Extra
t1 ref idx1 idx1 5 const 1 where used
table type possible_keys key key_len ref rows Extra
t1 const idx1 idx1 5 const 1
id
101
102
105
106
109
110
id
101
102
105
106
109
110
id uniq_id
3 1
4 2
7 3
8 4
id uniq_id
3 1
4 2
7 3
8 4
......@@ -45,3 +45,49 @@ select * from t1 where (a is null or a = 7) and b=7 and c=0;
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
select * from t1 where b like "6%";
drop table t1;
#
# The following failed for Matt Loschert
#
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id),
UNIQUE KEY idx1 (uniq_id)
) TYPE=MyISAM;
CREATE TABLE t2 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
#
# Check IS NULL optimization
#
explain select id from t1 where uniq_id is null;
explain select id from t1 where uniq_id =1;
#
# Check updates
#
UPDATE t1 SET id=id+100 where uniq_id is null;
UPDATE t2 SET id=id+100 where uniq_id is null;
select id from t1 where uniq_id is null;
select id from t2 where uniq_id is null;
#
# Delete all records from each table where the uniq_id field is null
#
DELETE FROM t1 WHERE uniq_id IS NULL;
DELETE FROM t2 WHERE uniq_id IS NULL;
#
# Select what is left -- notice the difference
#
SELECT * FROM t1 ORDER BY uniq_id, id;
SELECT * FROM t2 ORDER BY uniq_id, id;
DROP table t1,t2;
......@@ -49,9 +49,9 @@ EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c
libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_fn removed 980815 since it not upp to date test_dir
noinst_PROGRAMS = testhash test_charset @THREAD_LPROGRAMS@
noinst_PROGRAMS = test_charset @THREAD_LPROGRAMS@
# test_dir_DEPENDENCIES= $(LIBRARIES)
testhash_DEPENDENCIES= $(LIBRARIES)
# testhash_DEPENDENCIES= $(LIBRARIES)
test_charset_DEPENDENCIES= $(LIBRARIES)
EXTRA_PROGRAMS =
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
......@@ -81,17 +81,17 @@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
#
test_thr_alarm: thr_alarm.c $(LIBRARIES)
$(CP) -f $(srcdir)/thr_alarm.c ./test_thr_alarm.c
$(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_alarm.*
test_thr_lock: thr_lock.c $(LIBRARIES)
$(CP) -f $(srcdir)/thr_lock.c test_thr_lock.c
$(CP) $(srcdir)/thr_lock.c test_thr_lock.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_lock.*
test_vsnprintf: my_vsnprintf.c $(LIBRARIES)
$(CP) -f $(srcdir)/my_vsnprintf.c test_vsnprintf.c
$(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
$(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
$(RM) -f test_vsnprintf.*
......@@ -102,7 +102,7 @@ test_charset: test_charset.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
testhash: testhash.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -3891,7 +3891,7 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
char *blob;
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
if (!blob)
val_ptr->length(0);
val_ptr->set("",0); // A bit safer than ->length(0)
else
val_ptr->set((const char*) blob,get_length(ptr));
return val_ptr;
......
......@@ -321,7 +321,7 @@ static bool get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key,
static bool eq_tree(SEL_ARG* a,SEL_ARG *b);
static SEL_ARG null_element(SEL_ARG::IMPOSSIBLE);
static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length);
/***************************************************************************
** Basic functions for SQL_SELECT and QUICK_SELECT
......@@ -2306,7 +2306,15 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key,
KEY *table_key=quick->head->key_info+quick->index;
flag=EQ_RANGE;
if (table_key->flags & HA_NOSAME && key->part == table_key->key_parts-1)
flag|= UNIQUE_RANGE;
{
if (!(table_key->flags & HA_NULL_PART_KEY) ||
!null_part_in_key(key,
param->min_key,
(uint) (tmp_min_key - param->min_key)))
flag|= UNIQUE_RANGE;
else
flag|= NULL_RANGE;
}
}
}
......@@ -2339,7 +2347,7 @@ bool QUICK_SELECT::unique_key_range()
if (ranges.elements == 1)
{
QUICK_RANGE *tmp;
if ((tmp=ranges.head())->flag & EQ_RANGE)
if (((tmp=ranges.head())->flag & (EQ_RANGE | NULL_RANGE)) == EQ_RANGE)
{
KEY *key=head->key_info+index;
return ((key->flags & HA_NOSAME) &&
......@@ -2349,6 +2357,24 @@ bool QUICK_SELECT::unique_key_range()
return 0;
}
/* Returns true if any part of the key is NULL */
static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
{
for (const char *end=key+length ;
key < end;
key+= key_part++->part_length)
{
if (key_part->null_bit)
{
if (*key++)
return 1;
}
}
return 0;
}
/****************************************************************************
** Create a QUICK RANGE based on a key
****************************************************************************/
......
......@@ -30,6 +30,7 @@
#define NEAR_MAX 8
#define UNIQUE_RANGE 16
#define EQ_RANGE 32
#define NULL_RANGE 64
typedef struct st_key_part {
uint16 key,part,part_length;
......
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