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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
67d2f7c3
Commit
67d2f7c3
authored
Sep 19, 2013
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#81 denormalize dname in tokudb_file_map
parent
a7c2c574
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
37 deletions
+54
-37
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+54
-37
No files found.
storage/tokudb/hatoku_hton.cc
View file @
67d2f7c3
...
...
@@ -1295,15 +1295,18 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
struct
st_mysql_storage_engine
tokudb_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
};
static
struct
st_mysql_information_schema
tokudb_
dictionary_info
_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
struct
st_mysql_information_schema
tokudb_
file_map
_information_schema
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
static
ST_FIELD_INFO
tokudb_
dictionary
_field_info
[]
=
{
static
ST_FIELD_INFO
tokudb_
file_map
_field_info
[]
=
{
{
"dictionary_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"internal_file_name"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"database"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"table"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
"dictionary"
,
256
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
NULL
,
SKIP_OPEN_TABLE
}
};
static
int
tokudb_
dictionary_info
(
TABLE
*
table
,
THD
*
thd
)
{
static
int
tokudb_
file_map
(
TABLE
*
table
,
THD
*
thd
)
{
int
error
;
DB_TXN
*
txn
=
NULL
;
DBC
*
tmp_cursor
=
NULL
;
...
...
@@ -1320,30 +1323,47 @@ static int tokudb_dictionary_info(TABLE *table, THD *thd) {
goto
cleanup
;
}
while
(
error
==
0
)
{
error
=
tmp_cursor
->
c_get
(
tmp_cursor
,
&
curr_key
,
&
curr_val
,
DB_NEXT
);
error
=
tmp_cursor
->
c_get
(
tmp_cursor
,
&
curr_key
,
&
curr_val
,
DB_NEXT
);
if
(
!
error
)
{
// We store the NULL terminator in the directory so it's included in the size.
// See #5789
// Recalculate and check just to be safe.
size_t
dname_len
=
strlen
((
const
char
*
)
curr_key
.
data
)
;
size_t
iname_len
=
strlen
((
const
char
*
)
curr_val
.
data
);
const
char
*
dname
=
(
const
char
*
)
curr_key
.
data
;
size_t
dname_len
=
strlen
(
dname
);
assert
(
dname_len
==
curr_key
.
size
-
1
);
table
->
field
[
0
]
->
store
(
dname
,
dname_len
,
system_charset_info
);
const
char
*
iname
=
(
const
char
*
)
curr_val
.
data
;
size_t
iname_len
=
strlen
(
iname
);
assert
(
iname_len
==
curr_val
.
size
-
1
);
table
->
field
[
0
]
->
store
(
(
char
*
)
curr_key
.
data
,
dname_len
,
system_charset_info
);
table
->
field
[
1
]
->
store
(
(
char
*
)
curr_val
.
data
,
iname_len
,
system_charset_info
);
table
->
field
[
1
]
->
store
(
iname
,
iname_len
,
system_charset_info
);
// denormalize the dname
const
char
*
database_name
=
NULL
;
size_t
database_len
=
0
;
const
char
*
table_name
=
NULL
;
size_t
table_len
=
0
;
const
char
*
dictionary_name
=
NULL
;
size_t
dictionary_len
=
0
;
database_name
=
strchr
(
dname
,
'/'
);
if
(
database_name
)
{
database_name
+=
1
;
table_name
=
strchr
(
database_name
,
'/'
);
if
(
table_name
)
{
database_len
=
table_name
-
database_name
;
table_name
+=
1
;
dictionary_name
=
strchr
(
table_name
,
'-'
);
if
(
dictionary_name
)
{
table_len
=
dictionary_name
-
table_name
;
dictionary_name
+=
1
;
dictionary_len
=
strlen
(
dictionary_name
);
}
}
}
table
->
field
[
2
]
->
store
(
database_name
,
database_len
,
system_charset_info
);
table
->
field
[
3
]
->
store
(
table_name
,
table_len
,
system_charset_info
);
table
->
field
[
4
]
->
store
(
dictionary_name
,
dictionary_len
,
system_charset_info
);
error
=
schema_table_store_record
(
thd
,
table
);
}
}
...
...
@@ -1362,37 +1382,34 @@ static int tokudb_dictionary_info(TABLE *table, THD *thd) {
}
#if MYSQL_VERSION_ID >= 50600
static
int
tokudb_
dictionary_info
_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
)
{
static
int
tokudb_
file_map
_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
)
{
#else
static
int
tokudb_
dictionary_info
_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_
file_map
_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_
dictionary_info
(
table
,
thd
);
error
=
tokudb_
file_map
(
table
,
thd
);
}
//3938: unlock the status flag lock
rw_unlock
(
&
tokudb_hton_initialized_lock
);
return
error
;
}
static
int
tokudb_
dictionary_info
_init
(
void
*
p
)
{
static
int
tokudb_
file_map
_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
tokudb_
dictionary
_field_info
;
schema
->
fill_table
=
tokudb_
dictionary_info
_fill_table
;
schema
->
fields_info
=
tokudb_
file_map
_field_info
;
schema
->
fill_table
=
tokudb_
file_map
_fill_table
;
return
0
;
}
static
int
tokudb_
dictionary_info
_done
(
void
*
p
)
{
static
int
tokudb_
file_map
_done
(
void
*
p
)
{
return
0
;
}
...
...
@@ -2223,13 +2240,13 @@ mysql_declare_plugin(tokudb)
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_
dictionary_info
_information_schema
,
&
tokudb_
file_map
_information_schema
,
"TokuDB_file_map"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_
dictionary_info
_init
,
/* plugin init */
tokudb_
dictionary_info
_done
,
/* plugin deinit */
tokudb_
file_map
_init
,
/* plugin init */
tokudb_
file_map
_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
...
...
@@ -2339,13 +2356,13 @@ maria_declare_plugin(tokudb)
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
tokudb_
dictionary_info
_information_schema
,
&
tokudb_
file_map
_information_schema
,
"TokuDB_file_map"
,
"Tokutek Inc"
,
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology"
,
PLUGIN_LICENSE_GPL
,
tokudb_
dictionary_info
_init
,
/* plugin init */
tokudb_
dictionary_info
_done
,
/* plugin deinit */
tokudb_
file_map
_init
,
/* plugin init */
tokudb_
file_map
_done
,
/* plugin deinit */
TOKUDB_PLUGIN_VERSION
,
/* 4.0.0 */
NULL
,
/* status variables */
NULL
,
/* system variables */
...
...
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