Commit 6eb403cf authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-rand-4.1
parents b4bb6b7f 36120d42
...@@ -95,6 +95,7 @@ functions */ ...@@ -95,6 +95,7 @@ functions */
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF) #define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF) #define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
#define LL(A) ((__int64) A) #define LL(A) ((__int64) A)
#define ULL(A) ((unsigned __int64) A)
/* Type information */ /* Type information */
......
...@@ -842,6 +842,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ...@@ -842,6 +842,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#endif #endif
#endif #endif
#ifndef ULL
#ifdef HAVE_LONG_LONG
#define ULL(A) A ## ULL
#else
#define ULL(A) A ## UL
#endif
#endif
/* /*
Defines to make it possible to prioritize register assignments. No Defines to make it possible to prioritize register assignments. No
longer that important with modern compilers. longer that important with modern compilers.
......
...@@ -1729,7 +1729,7 @@ bool udf_handler::get_arguments() { return 0; } ...@@ -1729,7 +1729,7 @@ bool udf_handler::get_arguments() { return 0; }
pthread_mutex_t LOCK_user_locks; pthread_mutex_t LOCK_user_locks;
static HASH hash_user_locks; static HASH hash_user_locks;
class ULL class User_level_lock
{ {
char *key; char *key;
uint key_length; uint key_length;
...@@ -1741,7 +1741,7 @@ public: ...@@ -1741,7 +1741,7 @@ public:
pthread_t thread; pthread_t thread;
ulong thread_id; ulong thread_id;
ULL(const char *key_arg,uint length, ulong id) User_level_lock(const char *key_arg,uint length, ulong id)
:key_length(length),count(1),locked(1), thread_id(id) :key_length(length),count(1),locked(1), thread_id(id)
{ {
key=(char*) my_memdup((byte*) key_arg,length,MYF(0)); key=(char*) my_memdup((byte*) key_arg,length,MYF(0));
...@@ -1755,7 +1755,7 @@ public: ...@@ -1755,7 +1755,7 @@ public:
} }
} }
} }
~ULL() ~User_level_lock()
{ {
if (key) if (key)
{ {
...@@ -1765,11 +1765,12 @@ public: ...@@ -1765,11 +1765,12 @@ public:
pthread_cond_destroy(&cond); pthread_cond_destroy(&cond);
} }
inline bool initialized() { return key != 0; } inline bool initialized() { return key != 0; }
friend void item_user_lock_release(ULL *ull); friend void item_user_lock_release(User_level_lock *ull);
friend char *ull_get_key(const ULL *ull,uint *length,my_bool not_used); friend char *ull_get_key(const User_level_lock *ull, uint *length,
my_bool not_used);
}; };
char *ull_get_key(const ULL *ull,uint *length, char *ull_get_key(const User_level_lock *ull, uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length=(uint) ull->key_length; *length=(uint) ull->key_length;
...@@ -1797,7 +1798,7 @@ void item_user_lock_free(void) ...@@ -1797,7 +1798,7 @@ void item_user_lock_free(void)
} }
} }
void item_user_lock_release(ULL *ull) void item_user_lock_release(User_level_lock *ull)
{ {
ull->locked=0; ull->locked=0;
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -1853,7 +1854,7 @@ longlong Item_master_pos_wait::val_int() ...@@ -1853,7 +1854,7 @@ longlong Item_master_pos_wait::val_int()
void debug_sync_point(const char* lock_name, uint lock_timeout) void debug_sync_point(const char* lock_name, uint lock_timeout)
{ {
THD* thd=current_thd; THD* thd=current_thd;
ULL* ull; User_level_lock* ull;
struct timespec abstime; struct timespec abstime;
int lock_name_len,error=0; int lock_name_len,error=0;
lock_name_len=strlen(lock_name); lock_name_len=strlen(lock_name);
...@@ -1871,7 +1872,7 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) ...@@ -1871,7 +1872,7 @@ void debug_sync_point(const char* lock_name, uint lock_timeout)
this case, we will not be waiting, but rather, just waste CPU and this case, we will not be waiting, but rather, just waste CPU and
memory on the whole deal memory on the whole deal
*/ */
if (!(ull= ((ULL*) hash_search(&hash_user_locks,lock_name, if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, lock_name,
lock_name_len)))) lock_name_len))))
{ {
pthread_mutex_unlock(&LOCK_user_locks); pthread_mutex_unlock(&LOCK_user_locks);
...@@ -1932,7 +1933,7 @@ longlong Item_func_get_lock::val_int() ...@@ -1932,7 +1933,7 @@ longlong Item_func_get_lock::val_int()
longlong timeout=args[1]->val_int(); longlong timeout=args[1]->val_int();
struct timespec abstime; struct timespec abstime;
THD *thd=current_thd; THD *thd=current_thd;
ULL *ull; User_level_lock *ull;
int error=0; int error=0;
pthread_mutex_lock(&LOCK_user_locks); pthread_mutex_lock(&LOCK_user_locks);
...@@ -1951,10 +1952,11 @@ longlong Item_func_get_lock::val_int() ...@@ -1951,10 +1952,11 @@ longlong Item_func_get_lock::val_int()
thd->ull=0; thd->ull=0;
} }
if (!(ull= ((ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), if (!(ull= ((User_level_lock *) hash_search(&hash_user_locks,
res->length())))) (byte*) res->ptr(),
res->length()))))
{ {
ull=new ULL(res->ptr(),res->length(), thd->thread_id); ull=new User_level_lock(res->ptr(),res->length(), thd->thread_id);
if (!ull || !ull->initialized()) if (!ull || !ull->initialized())
{ {
delete ull; delete ull;
...@@ -2023,7 +2025,7 @@ longlong Item_func_get_lock::val_int() ...@@ -2023,7 +2025,7 @@ longlong Item_func_get_lock::val_int()
longlong Item_func_release_lock::val_int() longlong Item_func_release_lock::val_int()
{ {
String *res=args[0]->val_str(&value); String *res=args[0]->val_str(&value);
ULL *ull; User_level_lock *ull;
longlong result; longlong result;
if (!res || !res->length()) if (!res || !res->length())
{ {
...@@ -2034,8 +2036,9 @@ longlong Item_func_release_lock::val_int() ...@@ -2034,8 +2036,9 @@ longlong Item_func_release_lock::val_int()
result=0; result=0;
pthread_mutex_lock(&LOCK_user_locks); pthread_mutex_lock(&LOCK_user_locks);
if (!(ull= ((ULL*) hash_search(&hash_user_locks,(const byte*) res->ptr(), if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks,
res->length())))) (const byte*) res->ptr(),
res->length()))))
{ {
null_value=1; null_value=1;
} }
...@@ -3042,7 +3045,7 @@ longlong Item_func_is_free_lock::val_int() ...@@ -3042,7 +3045,7 @@ longlong Item_func_is_free_lock::val_int()
{ {
String *res=args[0]->val_str(&value); String *res=args[0]->val_str(&value);
THD *thd=current_thd; THD *thd=current_thd;
ULL *ull; User_level_lock *ull;
null_value=0; null_value=0;
if (!res || !res->length()) if (!res || !res->length())
...@@ -3052,7 +3055,7 @@ longlong Item_func_is_free_lock::val_int() ...@@ -3052,7 +3055,7 @@ longlong Item_func_is_free_lock::val_int()
} }
pthread_mutex_lock(&LOCK_user_locks); pthread_mutex_lock(&LOCK_user_locks);
ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(),
res->length()); res->length());
pthread_mutex_unlock(&LOCK_user_locks); pthread_mutex_unlock(&LOCK_user_locks);
if (!ull || !ull->locked) if (!ull || !ull->locked)
...@@ -3064,14 +3067,14 @@ longlong Item_func_is_used_lock::val_int() ...@@ -3064,14 +3067,14 @@ longlong Item_func_is_used_lock::val_int()
{ {
String *res=args[0]->val_str(&value); String *res=args[0]->val_str(&value);
THD *thd=current_thd; THD *thd=current_thd;
ULL *ull; User_level_lock *ull;
null_value=1; null_value=1;
if (!res || !res->length()) if (!res || !res->length())
return 0; return 0;
pthread_mutex_lock(&LOCK_user_locks); pthread_mutex_lock(&LOCK_user_locks);
ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(),
res->length()); res->length());
pthread_mutex_unlock(&LOCK_user_locks); pthread_mutex_unlock(&LOCK_user_locks);
if (!ull || !ull->locked) if (!ull || !ull->locked)
......
...@@ -863,9 +863,9 @@ public: ...@@ -863,9 +863,9 @@ public:
** User level locks ** User level locks
*/ */
class ULL; class User_level_lock;
void item_user_lock_init(void); void item_user_lock_init(void);
void item_user_lock_release(ULL *ull); void item_user_lock_release(User_level_lock *ull);
void item_user_lock_free(void); void item_user_lock_free(void);
class Item_func_get_lock :public Item_int_func class Item_func_get_lock :public Item_int_func
......
...@@ -64,14 +64,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -64,14 +64,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B)) #define all_bits_set(A,B) ((A) & (B) != (B))
#ifndef LL
#ifdef HAVE_LONG_LONG
#define LL(A) A ## LL
#else
#define LL(A) A ## L
#endif
#endif
extern CHARSET_INFO *system_charset_info, *files_charset_info ; extern CHARSET_INFO *system_charset_info, *files_charset_info ;
extern CHARSET_INFO *national_charset_info, *table_alias_charset; extern CHARSET_INFO *national_charset_info, *table_alias_charset;
......
...@@ -308,10 +308,10 @@ double log_10[32]; /* 10 potences */ ...@@ -308,10 +308,10 @@ double log_10[32]; /* 10 potences */
ulonglong log_10_int[20]= ulonglong log_10_int[20]=
{ {
1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL, 1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL,
100000000UL, 1000000000UL, 10000000000UL, 100000000000UL, ULL(100000000), ULL(1000000000), ULL(10000000000), ULL(100000000000),
1000000000000UL, 10000000000000UL, 100000000000000UL, ULL(1000000000000), ULL(10000000000000), ULL(100000000000000),
1000000000000000UL, 10000000000000000UL, 100000000000000000UL, ULL(1000000000000000), ULL(10000000000000000), ULL(100000000000000000),
1000000000000000000UL, 10000000000000000000UL ULL(1000000000000000000), ULL(10000000000000000000)
}; };
time_t start_time; time_t start_time;
......
...@@ -657,7 +657,7 @@ public: ...@@ -657,7 +657,7 @@ public:
points to a lock object if the lock is present. See item_func.cc and points to a lock object if the lock is present. See item_func.cc and
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK. chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
*/ */
ULL *ull; User_level_lock *ull;
#ifndef DBUG_OFF #ifndef DBUG_OFF
uint dbug_sentry; // watch out for memory corruption uint dbug_sentry; // watch out for memory corruption
#endif #endif
......
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