Commit fea5e799 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of (WL#4284):

------------------------------------------------------------
revno: 2617.23.23
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: mysql-6.0-runtime
timestamp: Thu 2009-03-05 18:39:58 -0300
message:
Fix for broken build: SHARED is defined by Solaris headers.
parent a3a23ec4
...@@ -42,8 +42,8 @@ class MDL_lock ...@@ -42,8 +42,8 @@ class MDL_lock
/** The type of lock (shared or exclusive). */ /** The type of lock (shared or exclusive). */
enum enum
{ {
SHARED, MDL_LOCK_SHARED,
EXCLUSIVE, MDL_LOCK_EXCLUSIVE,
} type; } type;
/** The key of the object (data) being protected. */ /** The key of the object (data) being protected. */
MDL_key key; MDL_key key;
...@@ -71,7 +71,7 @@ class MDL_lock ...@@ -71,7 +71,7 @@ class MDL_lock
inline static void destroy(MDL_lock *lock); inline static void destroy(MDL_lock *lock);
private: private:
MDL_lock(const MDL_key *key_arg) MDL_lock(const MDL_key *key_arg)
: type(SHARED), : type(MDL_LOCK_SHARED),
key(key_arg), key(key_arg),
cached_object(NULL), cached_object(NULL),
cached_object_release_hook(NULL) cached_object_release_hook(NULL)
...@@ -673,7 +673,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar ...@@ -673,7 +673,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar
case MDL_SHARED: case MDL_SHARED:
case MDL_SHARED_UPGRADABLE: case MDL_SHARED_UPGRADABLE:
case MDL_SHARED_HIGH_PRIO: case MDL_SHARED_HIGH_PRIO:
if (type == MDL_lock::SHARED) if (type == MDL_lock::MDL_LOCK_SHARED)
{ {
/* Pending exclusive locks have higher priority over shared locks. */ /* Pending exclusive locks have higher priority over shared locks. */
if (waiting.is_empty() || type_arg == MDL_SHARED_HIGH_PRIO) if (waiting.is_empty() || type_arg == MDL_SHARED_HIGH_PRIO)
...@@ -700,7 +700,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar ...@@ -700,7 +700,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar
There should be no active exclusive locks since we own shared lock There should be no active exclusive locks since we own shared lock
on the object. on the object.
*/ */
DBUG_ASSERT(type == MDL_lock::SHARED); DBUG_ASSERT(type == MDL_lock::MDL_LOCK_SHARED);
while ((conflicting_ticket= it++)) while ((conflicting_ticket= it++))
{ {
...@@ -717,7 +717,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar ...@@ -717,7 +717,7 @@ MDL_lock::can_grant_lock(const MDL_context *requestor_ctx, enum_mdl_type type_ar
can_grant= TRUE; can_grant= TRUE;
break; break;
} }
else if (type == MDL_lock::SHARED) else if (type == MDL_lock::MDL_LOCK_SHARED)
{ {
can_grant= granted.is_empty(); can_grant= granted.is_empty();
} }
...@@ -829,7 +829,7 @@ MDL_context::acquire_shared_lock(MDL_request *mdl_request, bool *retry) ...@@ -829,7 +829,7 @@ MDL_context::acquire_shared_lock(MDL_request *mdl_request, bool *retry)
if (!(lock= (MDL_lock*) my_hash_search(&mdl_locks, if (!(lock= (MDL_lock*) my_hash_search(&mdl_locks,
key->ptr(), key->length()))) key->ptr(), key->length())))
{ {
/* Default lock type is MDL_lock::SHARED */ /* Default lock type is MDL_lock::MDL_LOCK_SHARED */
lock= MDL_lock::create(key); lock= MDL_lock::create(key);
if (!lock || my_hash_insert(&mdl_locks, (uchar*)lock)) if (!lock || my_hash_insert(&mdl_locks, (uchar*)lock))
{ {
...@@ -972,7 +972,7 @@ bool MDL_context::acquire_exclusive_locks() ...@@ -972,7 +972,7 @@ bool MDL_context::acquire_exclusive_locks()
MDL_ticket *conflicting_ticket; MDL_ticket *conflicting_ticket;
MDL_lock::Ticket_iterator it(lock->granted); MDL_lock::Ticket_iterator it(lock->granted);
signalled= (lock->type == MDL_lock::EXCLUSIVE); signalled= (lock->type == MDL_lock::MDL_LOCK_EXCLUSIVE);
while ((conflicting_ticket= it++)) while ((conflicting_ticket= it++))
signalled|= notify_shared_lock(m_thd, conflicting_ticket); signalled|= notify_shared_lock(m_thd, conflicting_ticket);
...@@ -1009,7 +1009,7 @@ bool MDL_context::acquire_exclusive_locks() ...@@ -1009,7 +1009,7 @@ bool MDL_context::acquire_exclusive_locks()
global_lock.active_intention_exclusive++; global_lock.active_intention_exclusive++;
ticket= mdl_request->ticket; ticket= mdl_request->ticket;
lock= ticket->m_lock; lock= ticket->m_lock;
lock->type= MDL_lock::EXCLUSIVE; lock->type= MDL_lock::MDL_LOCK_EXCLUSIVE;
lock->waiting.remove(ticket); lock->waiting.remove(ticket);
lock->granted.push_front(ticket); lock->granted.push_front(ticket);
m_tickets.push_front(ticket); m_tickets.push_front(ticket);
...@@ -1135,7 +1135,7 @@ MDL_ticket::upgrade_shared_lock_to_exclusive() ...@@ -1135,7 +1135,7 @@ MDL_ticket::upgrade_shared_lock_to_exclusive()
} }
} }
m_lock->type= MDL_lock::EXCLUSIVE; m_lock->type= MDL_lock::MDL_LOCK_EXCLUSIVE;
/* Set the new type of lock in the ticket. */ /* Set the new type of lock in the ticket. */
m_type= MDL_EXCLUSIVE; m_type= MDL_EXCLUSIVE;
if (m_lock->cached_object) if (m_lock->cached_object)
...@@ -1200,7 +1200,7 @@ MDL_context::try_acquire_exclusive_lock(MDL_request *mdl_request, ...@@ -1200,7 +1200,7 @@ MDL_context::try_acquire_exclusive_lock(MDL_request *mdl_request,
goto err; goto err;
} }
mdl_request->ticket= ticket; mdl_request->ticket= ticket;
lock->type= MDL_lock::EXCLUSIVE; lock->type= MDL_lock::MDL_LOCK_EXCLUSIVE;
lock->granted.push_front(ticket); lock->granted.push_front(ticket);
m_tickets.push_front(ticket); m_tickets.push_front(ticket);
ticket->m_state= MDL_ACQUIRED; ticket->m_state= MDL_ACQUIRED;
...@@ -1355,7 +1355,7 @@ void MDL_context::release_ticket(MDL_ticket *ticket) ...@@ -1355,7 +1355,7 @@ void MDL_context::release_ticket(MDL_ticket *ticket)
lock->granted.remove(ticket); lock->granted.remove(ticket);
break; break;
case MDL_EXCLUSIVE: case MDL_EXCLUSIVE:
lock->type= MDL_lock::SHARED; lock->type= MDL_lock::MDL_LOCK_SHARED;
lock->granted.remove(ticket); lock->granted.remove(ticket);
global_lock.active_intention_exclusive--; global_lock.active_intention_exclusive--;
break; break;
...@@ -1497,7 +1497,7 @@ void MDL_ticket::downgrade_exclusive_lock() ...@@ -1497,7 +1497,7 @@ void MDL_ticket::downgrade_exclusive_lock()
return; return;
pthread_mutex_lock(&LOCK_mdl); pthread_mutex_lock(&LOCK_mdl);
m_lock->type= MDL_lock::SHARED; m_lock->type= MDL_lock::MDL_LOCK_SHARED;
m_type= MDL_SHARED_UPGRADABLE; m_type= MDL_SHARED_UPGRADABLE;
pthread_cond_broadcast(&COND_mdl); pthread_cond_broadcast(&COND_mdl);
pthread_mutex_unlock(&LOCK_mdl); pthread_mutex_unlock(&LOCK_mdl);
...@@ -1543,7 +1543,7 @@ MDL_context::is_exclusive_lock_owner(unsigned char type, ...@@ -1543,7 +1543,7 @@ MDL_context::is_exclusive_lock_owner(unsigned char type,
while ((ticket= it++)) while ((ticket= it++))
{ {
if (ticket->m_lock->type == MDL_lock::EXCLUSIVE && if (ticket->m_lock->type == MDL_lock::MDL_LOCK_EXCLUSIVE &&
ticket->m_lock->key.is_equal(&key)) ticket->m_lock->key.is_equal(&key))
break; break;
} }
......
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