Commit 6d668850 authored by unknown's avatar unknown

Merge eherman@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/home/eric/fed-txn-mysql-5.1-new

parents 3fdddf12 a80ba53e
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags"
extra_configs="$pentium_configs --without-berkeley-db"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs --without-berkeley-db $static_link"
. "$path/FINISH.sh"
......@@ -564,3 +564,7 @@ DROP TABLE tyt2;
DROP TABLE urkunde;
SHOW TABLES FROM non_existing_database;
ERROR 42000: Unknown database 'non_existing_database'
SHOW AUTHORS;
Name Location Comment
Brian "Krow" Aker Seattle, WA. USA Architecture, archive, federated, buncha of little stuff :)
David Axmark Uppsala, Sweden Small stuff long time ago, Monty ripped it out!
......@@ -424,3 +424,7 @@ DROP TABLE urkunde;
#
--error 1049
SHOW TABLES FROM non_existing_database;
# End of 4.1 tests
#
SHOW AUTHORS;
/***************************************************************************
** Output from "SHOW AUTHORS"
** If you can update it, you get to be in it :)
** Dont be offended if your name is not in here, just add it!
***************************************************************************/
struct show_table_authors_st {
const char *name;
const char *location;
const char *comment;
};
struct show_table_authors_st show_table_authors[]= {
{ "Brian \"Krow\" Aker", "Seattle, WA. USA",
"Architecture, archive, federated, buncha of little stuff :)" },
{ "David Axmark", "Uppsala, Sweden", "Small stuff long time ago, Monty ripped it out!"},
{NULL, NULL, NULL}
};
......@@ -1081,7 +1081,7 @@ public:
int cmp_max(const char *, const char *, uint max_length);
int cmp(const char *a,const char*b)
{
return cmp_max(a, b, ~0);
return cmp_max(a, b, ~0L);
}
void sort_string(char *buff,uint length);
void get_key_image(char *buff,uint length, imagetype type);
......@@ -1141,7 +1141,7 @@ public:
my_decimal *val_decimal(my_decimal *);
int cmp_max(const char *, const char *, uint max_length);
int cmp(const char *a,const char*b)
{ return cmp_max(a, b, ~0); }
{ return cmp_max(a, b, ~0L); }
int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length);
int cmp_binary(const char *a,const char *b, uint32 max_length=~0L);
int key_cmp(const byte *,const byte*);
......
......@@ -78,9 +78,11 @@ const char *ha_berkeley_ext=".db";
bool berkeley_shared_data=0;
u_int32_t berkeley_init_flags= DB_PRIVATE | DB_RECOVER, berkeley_env_flags=0,
berkeley_lock_type=DB_LOCK_DEFAULT;
ulong berkeley_cache_size, berkeley_log_buffer_size, berkeley_log_file_size=0;
ulong berkeley_log_buffer_size=0 , berkeley_log_file_size=0;
ulonglong berkeley_cache_size= 0;
char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
long berkeley_lock_scan_time=0;
ulong berkeley_region_size=0, berkeley_cache_parts=1;
ulong berkeley_trans_retry=1;
ulong berkeley_max_lock;
pthread_mutex_t bdb_mutex;
......@@ -89,9 +91,12 @@ static DB_ENV *db_env;
static HASH bdb_open_tables;
const char *berkeley_lock_names[] =
{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST",0 };
{ "DEFAULT", "OLDEST", "RANDOM", "YOUNGEST", "EXPIRE", "MAXLOCKS",
"MAXWRITE", "MINLOCKS", "MINWRITE", 0 };
u_int32_t berkeley_lock_types[]=
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM };
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM, DB_LOCK_YOUNGEST,
DB_LOCK_EXPIRE, DB_LOCK_MAXLOCKS, DB_LOCK_MAXWRITE, DB_LOCK_MINLOCKS,
DB_LOCK_MINWRITE };
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names)-1,"",
berkeley_lock_names, NULL};
......@@ -204,10 +209,17 @@ bool berkeley_init(void)
DB_VERB_DEADLOCK | DB_VERB_RECOVERY,
1);
db_env->set_cachesize(db_env, 0, berkeley_cache_size, 0);
if (berkeley_cache_size > (uint) ~0)
db_env->set_cachesize(db_env, berkeley_cache_size / (1024*1024L*1024L),
berkeley_cache_size % (1024L*1024L*1024L),
berkeley_cache_parts);
else
db_env->set_cachesize(db_env, 0, berkeley_cache_size, berkeley_cache_parts);
db_env->set_lg_max(db_env, berkeley_log_file_size);
db_env->set_lg_bsize(db_env, berkeley_log_buffer_size);
db_env->set_lk_detect(db_env, berkeley_lock_type);
db_env->set_lg_regionmax(db_env, berkeley_region_size);
if (berkeley_max_lock)
db_env->set_lk_max(db_env, berkeley_max_lock);
......
......@@ -163,7 +163,9 @@ extern const u_int32_t bdb_DB_PRIVATE;
extern bool berkeley_shared_data;
extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type,
berkeley_lock_types[];
extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size;
extern ulong berkeley_max_lock, berkeley_log_buffer_size;
extern ulonglong berkeley_cache_size;
extern ulong berkeley_region_size, berkeley_cache_parts;
extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
extern long berkeley_lock_scan_time;
extern TYPELIB berkeley_lock_typelib;
......
......@@ -74,6 +74,7 @@ static SYMBOL symbols[] = {
{ "ASC", SYM(ASC)},
{ "ASCII", SYM(ASCII_SYM)},
{ "ASENSITIVE", SYM(ASENSITIVE_SYM)},
{ "AUTHORS", SYM(AUTHORS_SYM)},
{ "AUTO_INCREMENT", SYM(AUTO_INC)},
{ "AVG", SYM(AVG_SYM)},
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)},
......
......@@ -857,6 +857,7 @@ int mysqld_show_variables(THD *thd,const char *wild);
int mysql_find_files(THD *thd,List<char> *files, const char *db,
const char *path, const char *wild, bool dir);
bool mysqld_show_storage_engines(THD *thd);
bool mysqld_show_authors(THD *thd);
bool mysqld_show_privileges(THD *thd);
bool mysqld_show_column_types(THD *thd);
bool mysqld_help (THD *thd, const char *text);
......
......@@ -394,7 +394,9 @@ extern const u_int32_t bdb_DB_TXN_NOSYNC, bdb_DB_RECOVER, bdb_DB_PRIVATE;
extern bool berkeley_shared_data;
extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type,
berkeley_lock_types[];
extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size;
extern ulong berkeley_max_lock, berkeley_log_buffer_size;
extern ulonglong berkeley_cache_size;
extern ulong berkeley_region_size, berkeley_cache_parts;
extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
extern long berkeley_lock_scan_time;
extern TYPELIB berkeley_lock_typelib;
......@@ -4582,8 +4584,10 @@ enum options_mysqld
OPT_INNODB_CONCURRENCY_TICKETS,
OPT_INNODB_THREAD_SLEEP_DELAY,
OPT_BDB_CACHE_SIZE,
OPT_BDB_CACHE_PARTS,
OPT_BDB_LOG_BUFFER_SIZE,
OPT_BDB_MAX_LOCK,
OPT_BDB_REGION_SIZE,
OPT_ERROR_LOG_FILE,
OPT_DEFAULT_WEEK_FORMAT,
OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
......@@ -5398,8 +5402,12 @@ log and this option does nothing anymore.",
#ifdef WITH_BERKELEY_STORAGE_ENGINE
{ "bdb_cache_size", OPT_BDB_CACHE_SIZE,
"The buffer that is allocated to cache index and rows for BDB tables.",
(gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG,
REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0},
(gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULL,
REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (ulonglong) ~0, 0, IO_SIZE, 0},
{ "bdb_cache_parts", OPT_BDB_CACHE_PARTS,
"Number of parts to use for BDB cache.",
(gptr*) &berkeley_cache_parts, (gptr*) &berkeley_cache_parts, 0, GET_ULONG,
REQUIRED_ARG, 1, 1, 1024, 0, 1, 0},
/* QQ: The following should be removed soon! (bdb_max_lock preferred) */
{"bdb_lock_max", OPT_BDB_MAX_LOCK, "Synonym for bdb_max_lock.",
(gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG,
......@@ -5412,6 +5420,10 @@ log and this option does nothing anymore.",
"The maximum number of locks you can have active on a BDB table.",
(gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG,
REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0},
{"bdb_region_size", OPT_BDB_REGION_SIZE,
"The size of the underlying logging area of the Berkeley DB environment.",
(gptr*) &berkeley_region_size, (gptr*) &berkeley_region_size, 0, GET_ULONG,
OPT_ARG, 60*1024L, 60*1024L, (long) ~0, 0, 1, 0},
#endif /* WITH_BERKELEY_STORAGE_ENGINE */
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
"The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.",
......@@ -7410,7 +7422,9 @@ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
#ifndef WITH_BERKELEY_STORAGE_ENGINE
bool berkeley_shared_data;
ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size;
ulong berkeley_max_lock, berkeley_log_buffer_size;
ulonglong berkeley_cache_size;
ulong berkeley_region_size, berkeley_cache_parts;
char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
#endif
......
......@@ -61,7 +61,9 @@
/* WITH_BERKELEY_STORAGE_ENGINE */
extern bool berkeley_shared_data;
extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size;
extern ulong berkeley_max_lock, berkeley_log_buffer_size;
extern ulonglong berkeley_cache_size;
extern ulong berkeley_region_size, berkeley_cache_parts;
extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
/* WITH_INNOBASE_STORAGE_ENGINE */
......@@ -622,11 +624,13 @@ struct show_var_st init_vars[]= {
{sys_automatic_sp_privileges.name,(char*) &sys_automatic_sp_privileges, SHOW_SYS},
{"back_log", (char*) &back_log, SHOW_LONG},
{"basedir", mysql_home, SHOW_CHAR},
{"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONG},
{"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONGLONG},
{"bdb_cache_parts", (char*) &berkeley_cache_parts, SHOW_LONG},
{"bdb_home", (char*) &berkeley_home, SHOW_CHAR_PTR},
{"bdb_log_buffer_size", (char*) &berkeley_log_buffer_size, SHOW_LONG},
{"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR},
{"bdb_max_lock", (char*) &berkeley_max_lock, SHOW_LONG},
{"bdb_region_size", (char*) &berkeley_region_size, SHOW_LONG},
{"bdb_shared_data", (char*) &berkeley_shared_data, SHOW_BOOL},
{"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR},
{sys_binlog_cache_size.name,(char*) &sys_binlog_cache_size, SHOW_SYS},
......
......@@ -215,6 +215,8 @@ struct Query_cache_memory_bin
struct Query_cache_memory_bin_step
{
public:
Query_cache_memory_bin_step() {}
ulong size;
ulong increment;
uint idx;
......
......@@ -92,6 +92,7 @@ enum enum_sql_command {
SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE,
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
SQLCOM_SHOW_AUTHORS,
/* This should be the last !!! */
SQLCOM_END
......
......@@ -3409,6 +3409,9 @@ end_with_restore_list:
case SQLCOM_SHOW_STORAGE_ENGINES:
res= mysqld_show_storage_engines(thd);
break;
case SQLCOM_SHOW_AUTHORS:
res= mysqld_show_authors(thd);
break;
case SQLCOM_SHOW_PRIVILEGES:
res= mysqld_show_privileges(thd);
break;
......
......@@ -23,6 +23,7 @@
#include "sp.h"
#include "sp_head.h"
#include "sql_trigger.h"
#include "authors.h"
#include <my_dir.h>
......@@ -56,6 +57,9 @@ bool mysqld_show_storage_engines(THD *thd)
field_list.push_back(new Item_empty_string("Engine",10));
field_list.push_back(new Item_empty_string("Support",10));
field_list.push_back(new Item_empty_string("Comment",80));
field_list.push_back(new Item_empty_string("Transactions",3));
field_list.push_back(new Item_empty_string("XA",3));
field_list.push_back(new Item_empty_string("Savepoints",3));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
......@@ -76,6 +80,9 @@ bool mysqld_show_storage_engines(THD *thd)
option_name= "DEFAULT";
protocol->store(option_name, system_charset_info);
protocol->store((*types)->comment, system_charset_info);
protocol->store((*types)->commit ? "YES" : "NO", system_charset_info);
protocol->store((*types)->prepare ? "YES" : "NO", system_charset_info);
protocol->store((*types)->savepoint_set ? "YES" : "NO", system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
}
......@@ -83,6 +90,38 @@ bool mysqld_show_storage_engines(THD *thd)
DBUG_RETURN(FALSE);
}
/***************************************************************************
** List all Authors.
** If you can update it, you get to be in it :)
***************************************************************************/
bool mysqld_show_authors(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_show_authors");
field_list.push_back(new Item_empty_string("Name",40));
field_list.push_back(new Item_empty_string("Location",40));
field_list.push_back(new Item_empty_string("Comment",80));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
show_table_authors_st *authors;
for (authors= show_table_authors; authors->name; authors++)
{
protocol->prepare_for_resend();
protocol->store(authors->name, system_charset_info);
protocol->store(authors->location, system_charset_info);
protocol->store(authors->comment, system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
}
send_eof(thd);
DBUG_RETURN(FALSE);
}
/***************************************************************************
List all privileges supported
......
......@@ -137,6 +137,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ASCII_SYM
%token ASENSITIVE_SYM
%token ATAN
%token AUTHORS_SYM
%token AUTO_INC
%token AVG_ROW_LENGTH
%token AVG_SYM
......@@ -7174,6 +7175,11 @@ show_param:
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
}
| AUTHORS_SYM
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_AUTHORS;
}
| PRIVILEGES
{
LEX *lex=Lex;
......@@ -8171,6 +8177,7 @@ user:
keyword:
keyword_sp {}
| ASCII_SYM {}
| AUTHORS_SYM {}
| BACKUP_SYM {}
| BEGIN_SYM {}
| BYTE_SYM {}
......
This diff is collapsed.
......@@ -23,6 +23,7 @@ exit $?
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "SuperPool.hpp"
#include "LinearPool.hpp"
#include <NdbOut.hpp>
template <Uint32 sz>
......@@ -198,6 +199,74 @@ sp_test(GroupPool& gp)
delete [] ptrList;
}
template <class T>
static void
lp_test(GroupPool& gp)
{
SuperPool& sp = gp.m_superPool;
LinearPool<T, 5> lp(gp);
ndbout << "linear pool test" << endl;
Ptr<T> ptr;
Uint32 loop;
for (loop = 0; loop < 3 * loopcount; loop++) {
int count = 0;
while (1) {
bool ret = lp.seize(ptr);
lp.verify();
if (! ret)
break;
assert(ptr.i == count);
Ptr<T> ptr2;
ptr2.i = ptr.i;
ptr2.p = 0;
lp.getPtr(ptr2);
assert(ptr.p == ptr2.p);
count++;
}
ndbout << "seized " << count << endl;
switch (loop % 3) {
case 0:
{
int n = 0;
while (n < count) {
ptr.i = n;
lp.release(ptr);
lp.verify();
n++;
}
ndbout << "released in order" << endl;
}
break;
case 1:
{
int n = count;
while (n > 0) {
n--;
ptr.i = n;
lp.release(ptr);
lp.verify();
}
ndbout << "released in reverse" << endl;
}
break;
default:
{
int coprime = random_coprime(count);
int n = 0;
while (n < count) {
int m = (coprime * n) % count;
ptr.i = m;
lp.release(ptr);
lp.verify();
n++;
}
ndbout << "released at random" << endl;
}
break;
}
}
}
static Uint32 pageSize = 32768;
static Uint32 pageBits = 17;
......@@ -218,6 +287,8 @@ template static void sp_test<T2>(GroupPool& sp);
template static void sp_test<T3>(GroupPool& sp);
template static void sp_test<T4>(GroupPool& sp);
template static void sp_test<T5>(GroupPool& sp);
//
template static void lp_test<T3>(GroupPool& sp);
int
main()
......@@ -231,13 +302,18 @@ main()
Uint16 s = (Uint16)getpid();
srandom(s);
ndbout << "rand " << s << endl;
int count = 0;
while (++count <= 1) {
int count;
count = 0;
while (++count <= 0) {
sp_test<T1>(gp);
sp_test<T2>(gp);
sp_test<T3>(gp);
sp_test<T4>(gp);
sp_test<T5>(gp);
}
count = 0;
while (++count <= 1) {
lp_test<T3>(gp);
}
return 0;
}
......@@ -115,7 +115,7 @@ server-id = 1
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 64M
#bdb_cache_size = 256M
#bdb_max_lock = 100000
# Uncomment the following if you are using InnoDB tables
......
......@@ -113,7 +113,7 @@ server-id = 1
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_cache_size = 16M
#bdb_max_lock = 10000
# Uncomment the following if you are using InnoDB tables
......
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