cleanup: unused open_table_from_share() flags

This commit is contained in:
Sergei Golubchik 2016-11-14 20:24:03 +01:00
parent db3f110864
commit b2c8d55c22
9 changed files with 23 additions and 59 deletions

View file

@ -370,16 +370,9 @@ enum enum_alter_inplace_result {
*/
#define HA_OPEN_KEYFILE 1
#define HA_OPEN_RNDFILE 2
#define HA_GET_INDEX 4
#define HA_GET_INFO 8 /* do a ha_info() after open */
#define HA_READ_ONLY 16 /* File opened as readonly */
/* Try readonly if can't open with read and write */
#define HA_TRY_READ_ONLY 32
#define HA_WAIT_IF_LOCKED 64 /* Wait if locked on open */
#define HA_ABORT_IF_LOCKED 128 /* skip if locked on open.*/
#define HA_BLOCK_LOCK 256 /* unlock when reading some records */
#define HA_OPEN_TEMPORARY 512
/* Some key definitions */
#define HA_KEY_NULL_LENGTH 1

View file

@ -411,7 +411,6 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
}
else
{
(*tables)->db_stat &= ~ HA_BLOCK_LOCK;
(*tables)->current_lock= lock_type;
}
}

View file

@ -4000,7 +4000,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
table->alias.set("weedout-tmp", sizeof("weedout-tmp")-1,
table_alias_charset);
table->reginfo.lock_type=TL_WRITE; /* Will be updated */
table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
table->db_stat=HA_OPEN_KEYFILE;
table->map=1;
table->temp_pool_slot = temp_pool_slot;
table->copy_blobs= 1;

View file

@ -1855,12 +1855,8 @@ retry_share:
goto err_lock;
error= open_table_from_share(thd, share, alias,
(uint) (HA_OPEN_KEYFILE |
HA_OPEN_RNDFILE |
HA_GET_INDEX |
HA_TRY_READ_ONLY),
(READ_KEYINFO | COMPUTE_TYPES |
EXTRA_RECORD),
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
thd->open_options, table, FALSE);
if (error)
@ -2694,10 +2690,8 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
DBUG_ASSERT(! share->is_view);
if (open_table_from_share(thd, share, table_list->alias,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX |
HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
ha_open_options | HA_OPEN_FOR_REPAIR,
entry, FALSE) || ! entry->file ||
(entry->file->is_crashed() && entry->file->ha_check_and_repair(thd)))

View file

@ -17133,7 +17133,7 @@ bool open_tmp_table(TABLE *table)
table->db_stat= 0;
return 1;
}
table->db_stat= HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
table->db_stat= HA_OPEN_KEYFILE;
(void) table->file->extra(HA_EXTRA_QUICK); /* Faster */
if (!table->is_created())
{

View file

@ -3261,13 +3261,8 @@ partititon_err:
/* The table struct is now initialized; Open the table */
if (db_stat)
{
if (db_stat & HA_OPEN_TEMPORARY)
ha_open_flags|= HA_OPEN_TMP_TABLE;
else if ((db_stat & HA_WAIT_IF_LOCKED) ||
(specialflag & SPECIAL_WAIT_IF_LOCKED))
if (specialflag & SPECIAL_WAIT_IF_LOCKED)
ha_open_flags|= HA_OPEN_WAIT_IF_LOCKED;
else if (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO))
ha_open_flags|= HA_OPEN_ABORT_IF_LOCKED;
else
ha_open_flags|= HA_OPEN_IGNORE_IF_LOCKED;

View file

@ -1116,13 +1116,8 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
}
if (open_table_from_share(this, share, alias,
(open_in_engine) ?
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX) : 0,
(uint) (READ_KEYINFO | COMPUTE_TYPES |
EXTRA_RECORD),
ha_open_options,
table,
open_in_engine ? (uint)HA_OPEN_KEYFILE : 0,
EXTRA_RECORD, ha_open_options, table,
open_in_engine ? false : true))
{
my_free(table);

View file

@ -83,64 +83,53 @@
/* Defines for use with openfrm, openprt and openfrd */
#define READ_ALL 1 /* openfrm: Read all parameters */
#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
#define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */
#define EXTRA_RECORD 8 /* Reserve space for an extra record */
#define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */
#define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */
#define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */
#define COMPUTE_TYPES 32 /* Kontrollera type f|r f{ltena */
#define SEARCH_PRG 64 /* S|k efter registret i 'prg_dev' */
#define READ_USED_NAMES 128 /* L{s anv{nda formul{rnamn */
#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
#define READ_SCREENS 1024 /* Read screens, info and helpfile */
#define DELAYED_OPEN 4096 /* Open table later */
#define OPEN_VIEW 8192 /* Allow open on view */
#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
but do not parse view itself */
#define READ_ALL (1 << 0) /* openfrm: Read all parameters */
#define EXTRA_RECORD (1 << 3) /* Reserve space for an extra record */
#define DELAYED_OPEN (1 << 12) /* Open table later */
#define OPEN_VIEW_NO_PARSE (1 << 14) /* Open frm only if it's a view,
but do not parse view itself */
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to open FRM file only to get necessary data.
*/
#define OPEN_FRM_FILE_ONLY 32768
#define OPEN_FRM_FILE_ONLY (1 << 15)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process tables only to get necessary data.
Views are not processed.
*/
#define OPEN_TABLE_ONLY (OPEN_FRM_FILE_ONLY*2)
#define OPEN_TABLE_ONLY (1 << 16)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process views only to get necessary data.
Tables are not processed.
*/
#define OPEN_VIEW_ONLY (OPEN_TABLE_ONLY*2)
#define OPEN_VIEW_ONLY (1 << 17)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine.
The flag means that we need to open a view using
open_normal_and_derived_tables() function.
*/
#define OPEN_VIEW_FULL (OPEN_VIEW_ONLY*2)
#define OPEN_VIEW_FULL (1 << 18)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine.
The flag means that I_S table uses optimization algorithm.
*/
#define OPTIMIZE_I_S_TABLE (OPEN_VIEW_FULL*2)
#define OPTIMIZE_I_S_TABLE (1 << 19)
/**
This flag is used to instruct tdc_open_view() to check metadata version.
*/
#define CHECK_METADATA_VERSION (OPEN_TRIGGER_ONLY*2)
#define CHECK_METADATA_VERSION (1 << 20)
/*
The flag means that we need to process trigger files only.
*/
#define OPEN_TRIGGER_ONLY (OPTIMIZE_I_S_TABLE*2)
#define OPEN_TRIGGER_ONLY (1 << 21)
/*
Minimum length pattern before Turbo Boyer-Moore is used

View file

@ -623,9 +623,8 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
}
if (enum open_frm_error err= open_table_from_share(thd, share, "",
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX | HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
(uint) (HA_OPEN_KEYFILE | HA_TRY_READ_ONLY),
EXTRA_RECORD,
thd->open_options, edges, FALSE))
{
open_table_error(share, err, EMFILE); // NOTE - EMFILE is probably bogus, it reports as too many open files (!)