MDEV-4786 - merge 10.0-monty → 10.0
Fixed test_sql_discovery compilation failure. storage/test_sql_discovery/mysql-test/archive/discover.rdiff: archive.discover result has changed during merge. Adjusted discover.rdiff accordingly. storage/test_sql_discovery/test_sql_discovery.cc: Adjusted test_sql_discovery according to: WL#4305 - storage-engine private data area per physical table.
This commit is contained in:
parent
6069e780dc
commit
84d073848a
@ -28,8 +28,8 @@
|
|||||||
drop table t0;
|
drop table t0;
|
||||||
show status like 'Handler_discover';
|
show status like 'Handler_discover';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
-Handler_discover 7
|
-Handler_discover 6
|
||||||
+Handler_discover 8
|
+Handler_discover 7
|
||||||
#
|
#
|
||||||
# Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
|
# Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
|
||||||
#
|
#
|
||||||
|
@ -40,18 +40,25 @@ static struct st_mysql_sys_var *sysvars[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct st_share {
|
class SHARE : public Handler_share {
|
||||||
const char *name;
|
public:
|
||||||
THR_LOCK lock;
|
THR_LOCK lock;
|
||||||
uint use_count;
|
SHARE()
|
||||||
struct st_share *next;
|
{
|
||||||
} SHARE;
|
thr_lock_init(&lock);
|
||||||
|
}
|
||||||
|
~SHARE()
|
||||||
|
{
|
||||||
|
thr_lock_delete(&lock);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ha_tsd: public handler
|
class ha_tsd: public handler
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
THR_LOCK_DATA lock;
|
THR_LOCK_DATA lock;
|
||||||
SHARE *share;
|
SHARE *share;
|
||||||
|
SHARE *get_share();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ha_tsd(handlerton *hton, TABLE_SHARE *table_arg)
|
ha_tsd(handlerton *hton, TABLE_SHARE *table_arg)
|
||||||
@ -87,39 +94,34 @@ public:
|
|||||||
int close(void);
|
int close(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
static SHARE *find_or_create_share(const char *table_name, TABLE *table)
|
SHARE *ha_tsd::get_share()
|
||||||
{
|
{
|
||||||
SHARE *share;
|
SHARE *tmp_share;
|
||||||
for (share = (SHARE*)table->s->ha_data; share; share = share->next)
|
lock_shared_ha_data();
|
||||||
if (my_strcasecmp(table_alias_charset, table_name, share->name) == 0)
|
if (!(tmp_share= static_cast<SHARE*>(get_ha_share_ptr())))
|
||||||
return share;
|
{
|
||||||
|
tmp_share= new SHARE;
|
||||||
|
if (!tmp_share)
|
||||||
|
goto err;
|
||||||
|
|
||||||
share = (SHARE*)alloc_root(&table->s->mem_root, sizeof(*share));
|
set_ha_share_ptr(static_cast<Handler_share*>(tmp_share));
|
||||||
bzero(share, sizeof(*share));
|
}
|
||||||
share->name = strdup_root(&table->s->mem_root, table_name);
|
err:
|
||||||
share->next = (SHARE*)table->s->ha_data;
|
unlock_shared_ha_data();
|
||||||
table->s->ha_data = share;
|
return tmp_share;
|
||||||
return share;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ha_tsd::open(const char *name, int mode, uint test_if_locked)
|
int ha_tsd::open(const char *name, int mode, uint test_if_locked)
|
||||||
{
|
{
|
||||||
mysql_mutex_lock(&table->s->LOCK_ha_data);
|
if (!(share= get_share()))
|
||||||
share = find_or_create_share(name, table);
|
return HA_ERR_OUT_OF_MEM;
|
||||||
if (share->use_count++ == 0)
|
|
||||||
thr_lock_init(&share->lock);
|
|
||||||
mysql_mutex_unlock(&table->s->LOCK_ha_data);
|
|
||||||
thr_lock_data_init(&share->lock,&lock,NULL);
|
|
||||||
|
|
||||||
|
thr_lock_data_init(&share->lock,&lock,NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ha_tsd::close(void)
|
int ha_tsd::close(void)
|
||||||
{
|
{
|
||||||
mysql_mutex_lock(&table->s->LOCK_ha_data);
|
|
||||||
if (--share->use_count == 0)
|
|
||||||
thr_lock_delete(&share->lock);
|
|
||||||
mysql_mutex_unlock(&table->s->LOCK_ha_data);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user