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
5c9c570e
Commit
5c9c570e
authored
Feb 20, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#186 update cardinality on first table open
parent
9b46c1a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
34 deletions
+21
-34
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+20
-33
storage/tokudb/ha_tokudb.h
storage/tokudb/ha_tokudb.h
+1
-1
No files found.
storage/tokudb/ha_tokudb.cc
View file @
5c9c570e
...
@@ -1740,6 +1740,22 @@ int ha_tokudb::initialize_share(
...
@@ -1740,6 +1740,22 @@ int ha_tokudb::initialize_share(
share
->
num_DBs
=
table_share
->
keys
+
tokudb_test
(
hidden_primary_key
);
share
->
num_DBs
=
table_share
->
keys
+
tokudb_test
(
hidden_primary_key
);
init_hidden_prim_key_info
(
txn
);
// initialize cardinality info from the status dictionary
{
uint
total_key_parts
=
tokudb
::
compute_total_key_parts
(
table_share
);
uint64_t
rec_per_key
[
total_key_parts
];
error
=
tokudb
::
get_card_from_status
(
share
->
status_block
,
txn
,
total_key_parts
,
rec_per_key
);
if
(
error
==
0
)
{
tokudb
::
set_card_in_key_info
(
table
,
total_key_parts
,
rec_per_key
);
}
else
{
for
(
uint
i
=
0
;
i
<
total_key_parts
;
i
++
)
rec_per_key
[
i
]
=
0
;
tokudb
::
set_card_in_key_info
(
table
,
total_key_parts
,
rec_per_key
);
}
}
error
=
0
;
error
=
0
;
exit:
exit:
if
(
do_commit
&&
txn
)
{
if
(
do_commit
&&
txn
)
{
...
@@ -1875,8 +1891,6 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
...
@@ -1875,8 +1891,6 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
key_read
=
false
;
key_read
=
false
;
stats
.
block_size
=
1
<<
20
;
// QQQ Tokudb DB block size
stats
.
block_size
=
1
<<
20
;
// QQQ Tokudb DB block size
init_hidden_prim_key_info
();
info
(
HA_STATUS_NO_LOCK
|
HA_STATUS_VARIABLE
|
HA_STATUS_CONST
);
info
(
HA_STATUS_NO_LOCK
|
HA_STATUS_VARIABLE
|
HA_STATUS_CONST
);
exit:
exit:
...
@@ -2975,26 +2989,11 @@ DBT *ha_tokudb::pack_ext_key(
...
@@ -2975,26 +2989,11 @@ DBT *ha_tokudb::pack_ext_key(
//
//
// get max used hidden primary key value
// get max used hidden primary key value
//
//
void
ha_tokudb
::
init_hidden_prim_key_info
()
{
void
ha_tokudb
::
init_hidden_prim_key_info
(
DB_TXN
*
txn
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
tokudb_pthread_mutex_lock
(
&
share
->
mutex
);
if
(
!
(
share
->
status
&
STATUS_PRIMARY_KEY_INIT
))
{
if
(
!
(
share
->
status
&
STATUS_PRIMARY_KEY_INIT
))
{
int
error
=
0
;
int
error
=
0
;
THD
*
thd
=
ha_thd
();
DB_TXN
*
txn
=
NULL
;
DBC
*
c
=
NULL
;
DBC
*
c
=
NULL
;
tokudb_trx_data
*
trx
=
NULL
;
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
ha_thd
(),
tokudb_hton
->
slot
);
bool
do_commit
=
false
;
if
(
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_TABLE
&&
trx
&&
trx
->
sub_sp_level
)
{
txn
=
trx
->
sub_sp_level
;
}
else
{
do_commit
=
true
;
error
=
txn_begin
(
db_env
,
0
,
&
txn
,
0
,
thd
);
assert
(
error
==
0
);
}
error
=
share
->
key_file
[
primary_key
]
->
cursor
(
error
=
share
->
key_file
[
primary_key
]
->
cursor
(
share
->
key_file
[
primary_key
],
share
->
key_file
[
primary_key
],
txn
,
txn
,
...
@@ -3012,12 +3011,8 @@ void ha_tokudb::init_hidden_prim_key_info() {
...
@@ -3012,12 +3011,8 @@ void ha_tokudb::init_hidden_prim_key_info() {
}
}
error
=
c
->
c_close
(
c
);
error
=
c
->
c_close
(
c
);
assert
(
error
==
0
);
assert
(
error
==
0
);
if
(
do_commit
)
{
commit_txn
(
txn
,
0
);
}
share
->
status
|=
STATUS_PRIMARY_KEY_INIT
;
share
->
status
|=
STATUS_PRIMARY_KEY_INIT
;
}
}
tokudb_pthread_mutex_unlock
(
&
share
->
mutex
);
TOKUDB_HANDLER_DBUG_VOID_RETURN
;
TOKUDB_HANDLER_DBUG_VOID_RETURN
;
}
}
...
@@ -5944,21 +5939,13 @@ int ha_tokudb::info(uint flag) {
...
@@ -5944,21 +5939,13 @@ int ha_tokudb::info(uint flag) {
}
}
if
((
flag
&
HA_STATUS_CONST
))
{
if
((
flag
&
HA_STATUS_CONST
))
{
stats
.
max_data_file_length
=
9223372036854775807ULL
;
stats
.
max_data_file_length
=
9223372036854775807ULL
;
uint
total_key_parts
=
tokudb
::
compute_total_key_parts
(
table_share
);
uint64_t
rec_per_key
[
total_key_parts
];
error
=
tokudb
::
get_card_from_status
(
share
->
status_block
,
txn
,
total_key_parts
,
rec_per_key
);
if
(
error
==
0
)
{
tokudb
::
set_card_in_key_info
(
table
,
total_key_parts
,
rec_per_key
);
}
else
{
for
(
uint
i
=
0
;
i
<
total_key_parts
;
i
++
)
rec_per_key
[
i
]
=
0
;
tokudb
::
set_card_in_key_info
(
table
,
total_key_parts
,
rec_per_key
);
}
}
}
/* Don't return key if we got an error for the internal primary key */
/* Don't return key if we got an error for the internal primary key */
if
(
flag
&
HA_STATUS_ERRKEY
&&
last_dup_key
<
table_share
->
keys
)
{
if
(
flag
&
HA_STATUS_ERRKEY
&&
last_dup_key
<
table_share
->
keys
)
{
errkey
=
last_dup_key
;
errkey
=
last_dup_key
;
}
}
if
(
flag
&
HA_STATUS_AUTO
&&
table
->
found_next_number_field
)
{
if
(
flag
&
HA_STATUS_AUTO
&&
table
->
found_next_number_field
)
{
THD
*
thd
=
table
->
in_use
;
THD
*
thd
=
table
->
in_use
;
struct
system_variables
*
variables
=
&
thd
->
variables
;
struct
system_variables
*
variables
=
&
thd
->
variables
;
...
...
storage/tokudb/ha_tokudb.h
View file @
5c9c570e
...
@@ -603,7 +603,7 @@ class ha_tokudb : public handler {
...
@@ -603,7 +603,7 @@ class ha_tokudb : public handler {
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
int
get_status
(
DB_TXN
*
trans
);
int
get_status
(
DB_TXN
*
trans
);
void
init_hidden_prim_key_info
();
void
init_hidden_prim_key_info
(
DB_TXN
*
txn
);
inline
void
get_auto_primary_key
(
uchar
*
to
)
{
inline
void
get_auto_primary_key
(
uchar
*
to
)
{
tokudb_pthread_mutex_lock
(
&
share
->
mutex
);
tokudb_pthread_mutex_lock
(
&
share
->
mutex
);
share
->
auto_ident
++
;
share
->
auto_ident
++
;
...
...
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