summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-07-17 21:04:01 +0300
committerunknown <monty@hundin.mysql.fi>2001-07-17 21:04:01 +0300
commit9302266bde215864e1b70d0be583c3eaac6be898 (patch)
treef19e7e378a6170f04e3eebee868b77be238b17d7
parent782750a0ed04f80a40665f787f2debeba0a587a0 (diff)
downloadmariadb-git-9302266bde215864e1b70d0be583c3eaac6be898.tar.gz
Removed wrong warning from thr_lock
Fixed problem with UPDATE and BDB tables Fixed problem with GRANT FILE privilege on database level mysqld --warnings works now Fixed problem with SHOW OPEN TABLES when not using BDB Added some tests for ALTER TABLE to the test scripts Docs/manual.texi: Added link to copyleft license. Updated Changelog configure.in: Fixed typo mysys/thr_lock.c: Removed wrong warning sql/ha_berkeley.cc: Fixed problem with UPDATE sql/sql_acl.cc: Fixed problem with GRANT FILE privilege on database level sql/sql_parse.cc: Fixed that you don't get aborted connection error if you are not using --warning sql/sql_show.cc: Fixed problem with SHOW OPEN TABLES when not using BDB tests/fork2_test.pl: Added test of ALTER TABLE tests/fork_big.pl: Added test of ALTER TABLE
-rw-r--r--Docs/manual.texi25
-rw-r--r--configure.in2
-rw-r--r--mysys/thr_lock.c36
-rw-r--r--sql/ha_berkeley.cc4
-rw-r--r--sql/sql_acl.cc7
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_show.cc2
-rwxr-xr-xtests/fork2_test.pl35
-rwxr-xr-xtests/fork_big.pl72
9 files changed, 148 insertions, 37 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 48e5597489e..6e2d730459f 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -3582,7 +3582,7 @@ in your applications or when you add not free extensions to the
become GPL through the GPL license that acts as a virus. By licensing
@strong{MySQL} server from @strong{MySQL AB} under a commercial
license you will avoid this problem.
-
+See @uref{http://www.gnu.org/copyleft/gpl-faq.html}.
@item
You have a commercial application that ONLY works with @strong{MySQL}
and ships the application with the @strong{MySQL} server. This is
@@ -45717,6 +45717,11 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.40
@itemize @bullet
@item
+Fixed problem with @code{UPDATE} and BDB tables.
+@item
+Fixed problem when using the @code{GRANT FILE ON database.* ...}; Previously
+we added the @code{DROP} privilege for the database.
+@item
Fixed that @code{DELETE FROM table_name ... LIMIT 0} and
@code{UPDATE FROM table_name ... LIMIT 0} doesn't delete/update anything.
@item
@@ -45747,8 +45752,8 @@ Fixed bug in @code{BDB} tables when querying empty tables.
Fixed a bug when using @code{COUNT(DISTINCT)} with @code{LEFT JOIN} and
there wasn't any matching rows.
@item
-Removed all documentation referring to the @code{GEMINI} table type. @code{GEMINI}
-is not released under an Open Source license.
+Removed all documentation referring to the @code{GEMINI} table
+type. @code{GEMINI} is not released under an Open Source license.
@end itemize
@node News-3.23.39, News-3.23.38, News-3.23.40, News-3.23.x
@@ -50796,15 +50801,19 @@ running not completed multi-statement transactions. (The transaction
will probably be ignored).
@item
+@code{ANALYZE TABLE}, @code{OPTIMIZE TABLE} and @code{REPAIR TABLE} may
+cause problems on tables for which you are using @code{INSERT DELAYED}.
+
+@item
Doing a @code{LOCK TABLE ..} and @code{FLUSH TABLES ..} doesn't
guarantee that there isn't a half-finished transaction in progress on the
table.
@item
-BDB tables are a bit slow to open from this. If you have many BDB tables
-in a database, it will take a long time to use the @code{mysql} client
-on the database if you are not using the @code{-A} option or if you are
-using @code{rehash}. This is especially notable when you have a big table
+BDB tables are a bit slow to open. If you have many BDB tables in a
+database, it will take a long time to use the @code{mysql} client on the
+database if you are not using the @code{-A} option or if you are using
+@code{rehash}. This is especially notable when you have a big table
cache.
@item
@@ -50959,6 +50968,8 @@ values in double. Using these will cause problems when trying to export
and import data. We should as an intermediate solution change @code{NaN} to
@code{NULL} (if possible) and @code{-Inf} and @code{Inf} to the
Minimum respective maximum possible @code{double} value.
+@item
+@code{LIMIT} on negative numbers are treated as big positive numbers.
@end itemize
The following are known bugs in earlier versions of @strong{MySQL}:
diff --git a/configure.in b/configure.in
index 20c419c7328..aa84f152095 100644
--- a/configure.in
+++ b/configure.in
@@ -2011,7 +2011,7 @@ and GNU make work together causes some files to depend on this
header, even if we're not building with Berkeley DB.
Obviously, if this file *is* used, it'll break and hopefully we can find
-out why this file was generated by $(top_srcdir)/configure instead of
+out why this file was generated by ${top_srcdir}/configure instead of
the real db.h.
If you run into some problems because of this file, please use mysql_bug
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 7c92a7fa5fa..cff4d3bbac8 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -110,7 +110,8 @@ my_bool init_thr_lock()
}
#ifdef EXTRA_DEBUG
-static int found_errors=0;
+#define MAX_FOUND_ERRORS 10 /* Report 10 first errors */
+static uint found_errors=0;
static int check_lock(struct st_lock_list *list, const char* lock_type,
const char *where, my_bool same_thread)
@@ -167,15 +168,16 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
static void check_locks(THR_LOCK *lock, const char *where,
my_bool allow_no_locks)
{
- if (!found_errors)
+ uint old_found_errors=found_errors;
+ if (found_errors < MAX_FOUND_ERRORS)
{
if (check_lock(&lock->write,"write",where,1) |
check_lock(&lock->write_wait,"write_wait",where,0) |
check_lock(&lock->read,"read",where,0) |
check_lock(&lock->read_wait,"read_wait",where,0))
- found_errors=1;
+ found_errors++;
- if (!found_errors)
+ if (found_errors < MAX_FOUND_ERRORS)
{
uint count=0;
THR_LOCK_DATA *data;
@@ -186,7 +188,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
if (count != lock->read_no_write_count)
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': Locks read_no_write_count was %u when it should have been %u\n", where, lock->read_no_write_count,count);
}
@@ -196,7 +198,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
if (!allow_no_locks && !lock->read.data &&
(lock->write_wait.data || lock->read_wait.data))
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': No locks in use but locks are in wait queue\n",
where);
@@ -205,7 +207,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
{
if (!allow_no_locks && lock->read_wait.data)
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': No write locks and waiting read locks\n",
where);
@@ -221,7 +223,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
(lock->write_wait.data->type == TL_WRITE_DELAYED &&
!lock->read.data)))
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': Write lock %d waiting while no exclusive read locks\n",where,(int) lock->write_wait.data->type);
}
@@ -235,7 +237,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
lock->write.data->type == TL_WRITE_ALLOW_WRITE &&
lock->write_wait.data->type == TL_WRITE_ALLOW_WRITE)
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock\n",
where);
@@ -243,16 +245,18 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
if (lock->read.data)
{
- if ((!pthread_equal(lock->write.data->thread,lock->read.data->thread) &&
- lock->write.data->type > TL_WRITE_DELAYED) ||
+ if ((!pthread_equal(lock->write.data->thread,
+ lock->read.data->thread) &&
+ lock->write.data->type > TL_WRITE_DELAYED &&
+ lock->write.data->type != TL_WRITE_ONLY) ||
((lock->write.data->type == TL_WRITE_CONCURRENT_INSERT ||
lock->write.data->type == TL_WRITE_ALLOW_WRITE) &&
lock->read_no_write_count))
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
- "Warning at '%s': Found lock that is write and read locked\n",
- where);
+ "Warning at '%s': Found lock of type %d that is write and read locked\n",
+ where, lock->write.data->type);
}
}
if (lock->read_wait.data)
@@ -260,7 +264,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
if (!allow_no_locks && lock->write.data->type <= TL_WRITE_DELAYED &&
lock->read_wait.data->type <= TL_READ_HIGH_PRIORITY)
{
- found_errors=1;
+ found_errors++;
fprintf(stderr,
"Warning at '%s': Found read lock of type %d waiting for write lock of type %d\n",
where,
@@ -270,7 +274,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
}
}
- if (found_errors)
+ if (found_errors != old_found_errors)
{
DBUG_PRINT("error",("Found wrong lock"));
}
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 32af39e4a0d..d2b3ef62865 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -453,9 +453,11 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
if ((primary_key=table->primary_key) >= MAX_KEY)
{ // No primary key
primary_key=table->keys;
+ key_used_on_scan=MAX_KEY;
ref_length=hidden_primary_key=BDB_HIDDEN_PRIMARY_KEY_LENGTH;
}
- key_used_on_scan=primary_key;
+ else
+ key_used_on_scan=primary_key;
/* Need some extra memory in case of packed keys */
uint max_key_length= table->max_key_length + MAX_REF_PARTS*3;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 0f3ee483400..0cca3df0b16 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1824,10 +1824,9 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
*Str,
(!db ? rights : 0), what)))
result= -1;
- if (db)
- if (( replace_db_table(tables[1].table, db, *Str, rights,
- what)))
- result= -1;
+ if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS,
+ what))
+ result= -1;
}
VOID(pthread_mutex_unlock(&acl_cache->lock));
pthread_mutex_unlock(&LOCK_grant);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ef2919c2e6c..87fbed47ef1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -554,7 +554,7 @@ pthread_handler_decl(handle_one_connection,arg)
free_root(&thd->mem_root,MYF(0));
if (net->error && net->vio != 0)
{
- if (!thd->killed && ! opt_warnings)
+ if (!thd->killed && opt_warnings)
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
thd->thread_id,(thd->db ? thd->db : "unconnected"),
thd->user ? thd->user : "unauthenticated",
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 84dc5931139..637ab4fe7e9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -599,7 +599,7 @@ mysqld_show_logs(THD *thd)
DBUG_RETURN(1);
#ifdef HAVE_BERKELEY_DB
- if (berkeley_show_logs(thd))
+ if (!berkeley_skip && berkeley_show_logs(thd))
DBUG_RETURN(-1);
#endif
diff --git a/tests/fork2_test.pl b/tests/fork2_test.pl
index e8a579d9d81..b5564e99c3f 100755
--- a/tests/fork2_test.pl
+++ b/tests/fork2_test.pl
@@ -6,6 +6,9 @@
# the last 3 does different selects on the tables.
# Er, hmmm..., something like that :^)
# Modified to do crazy-join, à la Nasdaq.
+#
+# This test uses the old obsolete mysql interface. For a test that uses
+# DBI, please take a look at fork_big.pl
$opt_loop_count=10000; # Change this to make test harder/easier
@@ -26,8 +29,8 @@ GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in",
"force") || die "Aborted";
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$Mysql::db_errstr=$opt_force=undef; # Ignore warnings from these
-print "Testing 9 multiple connections to a server with 1 insert/update\n";
-print "and 8 select connections.\n";
+print "Testing 10 multiple connections to a server with 1 insert/update\n";
+print "and 8 select connections and one ALTER TABLE.\n";
@testtables = qw(bench_f21 bench_f22 bench_f23 bench_f24 bench_f25);
@@ -83,6 +86,7 @@ test_2() if (($pid=fork()) == 0); $work{$pid}="simple3";
test_3() if (($pid=fork()) == 0); $work{$pid}="funny3";
test_2() if (($pid=fork()) == 0); $work{$pid}="simple4";
test_3() if (($pid=fork()) == 0); $work{$pid}="funny4";
+alter_test() if (($pid=fork()) == 0); $work{$pid}="alter";
$errors=0;
while (($pid=wait()) != -1)
@@ -205,6 +209,33 @@ sub test_3
exit(0);
}
+#
+# Do an ALTER TABLE every 20 seconds
+#
+sub alter_test
+{
+ my ($dbh,$count,$old_row_count,$row_count,$id,@row,$sth);
+ $dbh = Mysql->Connect($opt_host, $opt_db) || die $Mysql::db_errstr;
+ $id=$count=$row_count=0; $old_row_count= -1;
+ # Execute the test as long as we get more data into the table
+ while ($row_count != $old_row_count)
+ {
+ sleep(10);
+ $sth=$dbh->Query("ALTER TABLE $testtables[$id] modify info varchar(32)") or die "Couldn't execute ALTER TABLE\n";
+ $sth=0;
+ $id=($id+1) % $numtables;
+
+ # Test if insert test has ended
+ $sth=$dbh->query("select count(*) from $testtables[0]") or die "Couldn't execute count(*)\n";
+ @row = $sth->FetchRow();
+ $old_row_count= $row_count;
+ $row_count=$row[0];
+ $count++;
+ }
+ $dbh=0;
+ print "alter: Executed $count ALTER TABLE commands\n";
+ exit(0);
+}
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index 4009a9da71b..e082225604c 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -23,7 +23,7 @@ GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","s
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
print "Test of multiple connections that test the following things:\n";
-print "insert, select, delete, update, check, repair and flush\n";
+print "insert, select, delete, update, alter, check, repair and flush\n";
@testtables = ( ["bench_f31", ""],
["bench_f32", "row_format=fixed"],
@@ -34,7 +34,8 @@ $abort_table="bench_f39";
$numtables = $#testtables+1;
srand 100; # Make random numbers repeatable
-####
+
+####
#### Start timeing and start test
####
@@ -88,12 +89,14 @@ for ($i=0 ; $i < $opt_threads ; $i ++)
{
test_select() if (($pid=fork()) == 0); $work{$pid}="select_key";
}
+test_join() if (($pid=fork()) == 0); $work{$pid}="test_join";
test_select_count() if (($pid=fork()) == 0); $work{$pid}="select_count";
test_delete() if (($pid=fork()) == 0); $work{$pid}="delete";
test_update() if (($pid=fork()) == 0); $work{$pid}="update";
test_flush() if (($pid=fork()) == 0); $work{$pid}= "flush";
test_check() if (($pid=fork()) == 0); $work{$pid}="check";
test_repair() if (($pid=fork()) == 0); $work{$pid}="repair";
+test_alter() if (($pid=fork()) == 0); $work{$pid}="alter";
#test_database("test2") if (($pid=fork()) == 0); $work{$pid}="check_database";
print "Started " . ($opt_threads*2+4) . " threads\n";
@@ -244,6 +247,44 @@ sub test_select_count
}
#
+# select records
+# Do continously joins between the first and second table
+#
+
+sub test_join
+{
+ my ($dbh, $i, $j, $count, $loop);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $count_query=make_count_query($numtables);
+ $count=0;
+ $loop=9999;
+
+ $i=0;
+ while (($i++ % 100) || !test_if_abort($dbh))
+ {
+ if ($loop++ >= 100)
+ {
+ $loop=0;
+ $row_counts=simple_query($dbh, $count_query);
+ }
+ for ($j=0 ; $j < $numtables-1 ; $j++)
+ {
+ my ($id)= int rand $row_counts->[$j];
+ my ($t1,$t2)= ($testtables[$j]->[0],$testtables[$j+1]->[0]);
+ simple_query($dbh, "select $t1.id,$t2.info from $t1, $t2 where $t1.id=$t2.id and $t1.id=$id");
+ $count++;
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_join: Executed $count joins\n";
+ exit(0);
+}
+
+#
# Delete 1-5 rows from the first 2 tables.
# Test ends when the number of rows for table 3 didn't change during
# one loop
@@ -457,6 +498,29 @@ sub test_database
exit(0);
}
+#
+# Test ALTER TABLE on the second table
+#
+
+sub test_alter
+{
+ my ($dbh, $row, $i, $type, $table);
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ for ($i=0 ; !test_if_abort($dbh) ; $i++)
+ {
+ sleep(100);
+ $table=$testtables[1]->[0];
+ $sth=$dbh->prepare("ALTER table $table modify info char(32)") || die "Got error on prepare: $DBI::errstr\n";
+ $sth->execute || die $DBI::errstr;
+ }
+ $dbh->disconnect; $dbh=0;
+ print "test_alter: Executed $i ALTER TABLE\n";
+ exit(0);
+}
+
#
# Help functions
@@ -507,8 +571,8 @@ sub simple_query()
my ($dbh, $query)= @_;
my ($sth,$row);
- $sth=$dbh->prepare($query) || die "Got error on '$query': $DBI::errstr\n";
- $sth->execute || die "Got error on '$query': $dbh->errstr\n";
+ $sth=$dbh->prepare($query) || die "Got error on '$query': " . $dbh->errstr . "\n";
+ $sth->execute || die "Got error on '$query': " . $dbh->errstr . "\n";
$row= $sth->fetchrow_arrayref();
$sth=0;
return $row;