Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
de7b04ef
Commit
de7b04ef
authored
Sep 17, 2013
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #82 delete the user data information schemas
parent
770533e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
340 deletions
+1
-340
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+1
-340
No files found.
storage/tokudb/hatoku_hton.cc
View file @
de7b04ef
...
@@ -1534,281 +1534,6 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
...
@@ -1534,281 +1534,6 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
struct
st_mysql_storage_engine
tokudb_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
};
struct
st_mysql_storage_engine
tokudb_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
};
static
struct
st_mysql_information_schema
tokudb_user_data_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
ST_FIELD_INFO
tokudb_user_data_field_info
[]
=
{
{
"database_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"table_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"data_size"
,
0
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
}
};
static
int
store_dbname_tablename_size
(
TABLE
*
table
,
char
*
name
,
uint64_t
size
,
THD
*
thd
)
{
char
*
tp
=
strrchr
(
name
,
'/'
);
assert
(
tp
);
char
*
tablename
=
tp
+
1
;
size_t
tablename_length
=
strlen
(
tablename
);
char
*
dp
=
strchr
(
name
,
'/'
);
char
*
dbname
;
size_t
dbname_length
;
if
(
dp
==
tp
)
{
dbname
=
name
;
dbname_length
=
tp
-
dbname
;
}
else
{
dbname
=
dp
+
1
;
dbname_length
=
tp
-
dbname
;
}
table
->
field
[
0
]
->
store
(
dbname
,
dbname_length
,
system_charset_info
);
table
->
field
[
1
]
->
store
(
tablename
,
tablename_length
,
system_charset_info
);
table
->
field
[
2
]
->
store
(
size
,
false
);
int
error
=
schema_table_store_record
(
thd
,
table
);
return
error
;
}
static
int
tokudb_get_user_data_size
(
TABLE
*
table
,
THD
*
thd
,
bool
exact
)
{
int
error
;
DB
*
curr_db
=
NULL
;
DB_TXN
*
txn
=
NULL
;
DBC
*
tmp_cursor
=
NULL
;
DBC
*
tmp_table_cursor
=
NULL
;
DBT
curr_key
;
DBT
curr_val
;
DB_TXN
*
tmp_txn
=
NULL
;
memset
(
&
curr_key
,
0
,
sizeof
curr_key
);
memset
(
&
curr_val
,
0
,
sizeof
curr_val
);
pthread_mutex_lock
(
&
tokudb_meta_mutex
);
error
=
txn_begin
(
db_env
,
0
,
&
txn
,
DB_READ_UNCOMMITTED
,
thd
);
if
(
error
)
{
goto
cleanup
;
}
error
=
metadata_db
->
cursor
(
metadata_db
,
txn
,
&
tmp_cursor
,
0
);
if
(
error
)
{
goto
cleanup
;
}
while
(
error
==
0
)
{
tmp_txn
=
NULL
;
//
// here, and in other places, check if process has been killed
// if so, get out of function so user is not stalled
//
if
(
thd
->
killed
)
{
break
;
}
error
=
txn_begin
(
db_env
,
0
,
&
tmp_txn
,
DB_READ_UNCOMMITTED
,
thd
);
if
(
error
)
{
goto
cleanup
;
}
//
// do not need this to be super fast, so use old simple API
//
error
=
tmp_cursor
->
c_get
(
tmp_cursor
,
&
curr_key
,
&
curr_val
,
DB_NEXT
);
if
(
!
error
)
{
char
*
name
=
(
char
*
)
curr_key
.
data
;
char
*
newname
;
uint64_t
curr_num_bytes
=
0
;
DB_BTREE_STAT64
dict_stats
;
error
=
db_create
(
&
curr_db
,
db_env
,
0
);
if
(
error
)
{
goto
cleanup
;
}
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
make_name
(
newname
,
name
,
"main"
);
error
=
curr_db
->
open
(
curr_db
,
tmp_txn
,
newname
,
NULL
,
DB_BTREE
,
DB_THREAD
,
0
);
my_free
(
newname
,
MYF
(
0
));
if
(
error
==
ENOENT
)
{
error
=
0
;
continue
;
}
if
(
error
)
{
goto
cleanup
;
}
if
(
exact
)
{
//
// flatten if exact is required
//
uint
curr_num_items
=
0
;
error
=
curr_db
->
cursor
(
curr_db
,
tmp_txn
,
&
tmp_table_cursor
,
0
);
if
(
error
)
{
tmp_table_cursor
=
NULL
;
goto
cleanup
;
}
while
(
error
!=
DB_NOTFOUND
)
{
error
=
tmp_table_cursor
->
c_getf_next
(
tmp_table_cursor
,
0
,
smart_dbt_do_nothing
,
NULL
);
if
(
error
&&
error
!=
DB_NOTFOUND
)
{
goto
cleanup
;
}
curr_num_items
++
;
//
// allow early exit if command has been killed
//
if
(
(
curr_num_items
%
1000
)
==
0
&&
thd
->
killed
)
{
goto
cleanup
;
}
}
error
=
tmp_table_cursor
->
c_close
(
tmp_table_cursor
);
assert
(
error
==
0
);
tmp_table_cursor
=
NULL
;
}
error
=
curr_db
->
stat64
(
curr_db
,
tmp_txn
,
&
dict_stats
);
if
(
error
)
{
goto
cleanup
;
}
curr_num_bytes
=
dict_stats
.
bt_dsize
;
if
(
*
(
uchar
*
)
curr_val
.
data
)
{
//
// in this case, we have a hidden primary key, do not
// want to report space taken up by the hidden primary key to the user
//
uint64_t
hpk_space
=
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
*
dict_stats
.
bt_ndata
;
curr_num_bytes
=
(
hpk_space
>
curr_num_bytes
)
?
0
:
curr_num_bytes
-
hpk_space
;
}
else
{
//
// one infinity byte per key needs to be subtracted
//
uint64_t
inf_byte_space
=
dict_stats
.
bt_ndata
;
curr_num_bytes
=
(
inf_byte_space
>
curr_num_bytes
)
?
0
:
curr_num_bytes
-
inf_byte_space
;
}
error
=
store_dbname_tablename_size
(
table
,
name
,
curr_num_bytes
,
thd
);
if
(
error
)
goto
cleanup
;
{
int
r
=
curr_db
->
close
(
curr_db
,
0
);
assert
(
r
==
0
);
curr_db
=
NULL
;
}
}
if
(
tmp_txn
)
{
commit_txn
(
tmp_txn
,
0
);
tmp_txn
=
NULL
;
}
}
error
=
0
;
cleanup:
if
(
tmp_cursor
)
{
int
r
=
tmp_cursor
->
c_close
(
tmp_cursor
);
assert
(
r
==
0
);
}
if
(
tmp_table_cursor
)
{
int
r
=
tmp_table_cursor
->
c_close
(
tmp_table_cursor
);
assert
(
r
==
0
);
}
if
(
curr_db
)
{
int
r
=
curr_db
->
close
(
curr_db
,
0
);
assert
(
r
==
0
);
}
if
(
tmp_txn
)
{
commit_txn
(
tmp_txn
,
0
);
}
if
(
txn
)
{
commit_txn
(
txn
,
0
);
}
if
(
error
)
{
sql_print_error
(
"got an error %d in show_data_size
\n
"
,
error
);
}
pthread_mutex_unlock
(
&
tokudb_meta_mutex
);
return
error
;
}
#if MYSQL_VERSION_ID >= 50600
static
int
tokudb_user_data_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
)
{
#else
static
int
tokudb_user_data_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
int
error
;
TABLE
*
table
=
tables
->
table
;
// 3938: Get a read lock on the status flag, since we must
// read it before safely proceeding
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
if
(
!
tokudb_hton_initialized
)
{
my_error
(
ER_PLUGIN_IS_NOT_LOADED
,
MYF
(
0
),
"TokuDB"
);
error
=
-
1
;
}
else
{
error
=
tokudb_get_user_data_size
(
table
,
thd
,
false
);
}
// 3938: unlock the status flag lock
rw_unlock
(
&
tokudb_hton_initialized_lock
);
return
error
;
}
static
int
tokudb_user_data_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
tokudb_user_data_field_info
;
schema
->
fill_table
=
tokudb_user_data_fill_table
;
return
0
;
}
static
int
tokudb_user_data_done
(
void
*
p
)
{
return
0
;
}
static
struct
st_mysql_information_schema
tokudb_user_data_exact_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
ST_FIELD_INFO
tokudb_user_data_exact_field_info
[]
=
{
{
"database_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"table_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"data_size"
,
0
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
}
};
#if MYSQL_VERSION_ID >= 50600
static
int
tokudb_user_data_exact_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
)
{
#else
static
int
tokudb_user_data_exact_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
int
error
;
TABLE
*
table
=
tables
->
table
;
// 3938: Get a read lock on the status flag, since we must
// read it before safely proceeding
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
if
(
!
tokudb_hton_initialized
)
{
my_error
(
ER_PLUGIN_IS_NOT_LOADED
,
MYF
(
0
),
"TokuDB"
);
error
=
-
1
;
}
else
{
error
=
tokudb_get_user_data_size
(
table
,
thd
,
true
);
}
//3938: unlock the status flag lock
rw_unlock
(
&
tokudb_hton_initialized_lock
);
return
error
;
}
static
int
tokudb_user_data_exact_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
tokudb_user_data_exact_field_info
;
schema
->
fill_table
=
tokudb_user_data_exact_fill_table
;
return
0
;
}
static
int
tokudb_user_data_exact_done
(
void
*
p
)
{
return
0
;
}
static
struct
st_mysql_information_schema
tokudb_dictionary_info_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
struct
st_mysql_information_schema
tokudb_dictionary_info_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
ST_FIELD_INFO
tokudb_dictionary_field_info
[]
=
{
static
ST_FIELD_INFO
tokudb_dictionary_field_info
[]
=
{
...
@@ -2735,40 +2460,6 @@ mysql_declare_plugin(tokudb)
...
@@ -2735,40 +2460,6 @@ mysql_declare_plugin(tokudb)
0
,
/* flags */
0
,
/* flags */
#endif
#endif
},
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_user_data_information_schema
,
"TokuDB_user_data"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_user_data_init
,
/* plugin init */
tokudb_user_data_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
NULL
,
/* config options */
#if MYSQL_VERSION_ID >= 50521
0
,
/* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_user_data_exact_information_schema
,
"TokuDB_user_data_exact"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_user_data_exact_init
,
/* plugin init */
tokudb_user_data_exact_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
NULL
,
/* config options */
#if MYSQL_VERSION_ID >= 50521
0
,
/* flags */
#endif
},
{
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_dictionary_info_information_schema
,
&
tokudb_dictionary_info_information_schema
,
...
@@ -2887,37 +2578,7 @@ maria_declare_plugin(tokudb)
...
@@ -2887,37 +2578,7 @@ maria_declare_plugin(tokudb)
},
},
{
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_user_data_information_schema
,
&
tokudb_dictionary_info_information_schema
,
"TokuDB_user_data"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_user_data_init
,
/* plugin init */
tokudb_user_data_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
TOKUDB_PLUGIN_VERSION_STR
,
/* string version */
MariaDB_PLUGIN_MATURITY_STABLE
/* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_user_data_exact_information_schema
,
"TokuDB_user_data_exact"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_user_data_exact_init
,
/* plugin init */
tokudb_user_data_exact_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
TOKUDB_PLUGIN_VERSION_STR
,
/* string version */
MariaDB_PLUGIN_MATURITY_STABLE
/* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_user_data_exact_information_schema
,
"TokuDB_file_map"
,
"TokuDB_file_map"
,
"Tokutek Inc"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment