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
f566889a
Commit
f566889a
authored
Nov 01, 2019
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.3' into 10.4
parents
ec40980d
9c6fec88
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
13 deletions
+60
-13
storage/rocksdb/ha_rocksdb.cc
storage/rocksdb/ha_rocksdb.cc
+3
-3
storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result
...age/rocksdb/mysql-test/rocksdb/r/show_table_status.result
+24
-1
storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
+25
-2
storage/rocksdb/rdb_datadic.cc
storage/rocksdb/rdb_datadic.cc
+1
-1
storage/rocksdb/rdb_datadic.h
storage/rocksdb/rdb_datadic.h
+7
-6
No files found.
storage/rocksdb/ha_rocksdb.cc
View file @
f566889a
...
...
@@ -3010,7 +3010,7 @@ class Rdb_transaction {
time_t
tm
;
tm
=
time
(
nullptr
);
for
(
auto
&
it
:
modified_tables
)
{
it
->
update_time
=
tm
;
it
->
m_
update_time
=
tm
;
}
modified_tables
.
clear
();
}
...
...
@@ -11044,11 +11044,11 @@ int ha_rocksdb::info(uint flag) {
}
}
stats
.
create_time
=
m_tbl_def
->
get_creat
ion
_time
();
stats
.
create_time
=
m_tbl_def
->
get_creat
e
_time
();
}
if
(
flag
&
HA_STATUS_TIME
)
{
stats
.
update_time
=
m_tbl_def
->
update_time
;
stats
.
update_time
=
m_tbl_def
->
m_
update_time
;
}
if
(
flag
&
HA_STATUS_ERRKEY
)
{
...
...
storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result
View file @
f566889a
...
...
@@ -75,7 +75,25 @@ select create_time, update_time into @create_tm, @update_tm
from information_schema.tables
where table_schema=database() and table_name='t1';
# Then, an in-place ALTER TABLE:
select sleep(2);
sleep(2) 0
alter table t1 add key (a);
# create_time will change as .frm file is rewritten:
select
create_time=@create_tm,
update_time
from information_schema.tables
where table_schema=database() and table_name='t1';
create_time=@create_tm 0
update_time NULL
# Check TRUNCATE TABLE
insert into t1 values (10,10);
select create_time, update_time into @create_tm, @update_tm
from information_schema.tables
where table_schema=database() and table_name='t1';
select sleep(2);
sleep(2) 0
truncate table t1;
select
create_time=@create_tm /* should not change */,
update_time
...
...
@@ -86,13 +104,18 @@ update_time NULL
#
# Check what is left after server restart
#
drop table t1;
create table t1 (a int);
insert into t1 values (1);
# Save t1's creation time
create table t2 as
select create_time
from information_schema.tables
where table_schema=database() and table_name='t1';
select sleep(2);
sleep(2) 0
select
create_time=(select create_time from t2) /* should change */,
create_time=(select create_time from t2) /* should
not
change */,
update_time
from information_schema.tables
where table_schema=database() and table_name='t1';
...
...
storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
View file @
f566889a
...
...
@@ -114,26 +114,49 @@ from information_schema.tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
--
echo
# Then, an in-place ALTER TABLE:
select
sleep
(
2
);
alter
table
t1
add
key
(
a
);
--
echo
# create_time will change as .frm file is rewritten:
select
create_time
=@
create_tm
,
update_time
from
information_schema
.
tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
--
echo
# Check TRUNCATE TABLE
insert
into
t1
values
(
10
,
10
);
select
create_time
,
update_time
into
@
create_tm
,
@
update_tm
from
information_schema
.
tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
select
sleep
(
2
);
truncate
table
t1
;
select
create_time
=@
create_tm
/* should not change */
,
update_time
from
information_schema
.
tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
--
echo
#
--
echo
# Check what is left after server restart
--
echo
#
drop
table
t1
;
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
);
--
echo
# Save t1's creation time
create
table
t2
as
select
create_time
from
information_schema
.
tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
select
sleep
(
2
);
--
source
include
/
restart_mysqld
.
inc
select
create_time
=
(
select
create_time
from
t2
)
/* should change */
,
create_time
=
(
select
create_time
from
t2
)
/* should
not
change */
,
update_time
from
information_schema
.
tables
where
table_schema
=
database
()
and
table_name
=
't1'
;
...
...
storage/rocksdb/rdb_datadic.cc
View file @
f566889a
...
...
@@ -3592,7 +3592,7 @@ bool Rdb_tbl_def::put_dict(Rdb_dict_manager *const dict,
return
false
;
}
time_t
Rdb_tbl_def
::
get_creat
ion
_time
()
{
time_t
Rdb_tbl_def
::
get_creat
e
_time
()
{
time_t
create_time
=
m_create_time
;
if
(
create_time
==
CREATE_TIME_UNKNOWN
)
{
...
...
storage/rocksdb/rdb_datadic.h
View file @
f566889a
...
...
@@ -1093,27 +1093,24 @@ class Rdb_tbl_def {
explicit
Rdb_tbl_def
(
const
std
::
string
&
name
)
:
m_key_descr_arr
(
nullptr
),
m_hidden_pk_val
(
0
),
m_auto_incr_val
(
0
),
m_create_time
(
CREATE_TIME_UNKNOWN
)
{
m_
update_time
(
0
),
m_
create_time
(
CREATE_TIME_UNKNOWN
)
{
set_name
(
name
);
}
Rdb_tbl_def
(
const
char
*
const
name
,
const
size_t
len
)
:
m_key_descr_arr
(
nullptr
),
m_hidden_pk_val
(
0
),
m_auto_incr_val
(
0
),
m_create_time
(
CREATE_TIME_UNKNOWN
)
{
m_
update_time
(
0
),
m_
create_time
(
CREATE_TIME_UNKNOWN
)
{
set_name
(
std
::
string
(
name
,
len
));
}
explicit
Rdb_tbl_def
(
const
rocksdb
::
Slice
&
slice
,
const
size_t
pos
=
0
)
:
m_key_descr_arr
(
nullptr
),
m_hidden_pk_val
(
0
),
m_auto_incr_val
(
0
),
m_create_time
(
CREATE_TIME_UNKNOWN
)
{
m_
update_time
(
0
),
m_
create_time
(
CREATE_TIME_UNKNOWN
)
{
set_name
(
std
::
string
(
slice
.
data
()
+
pos
,
slice
.
size
()
-
pos
));
}
~
Rdb_tbl_def
();
time_t
get_creation_time
();
time_t
update_time
=
0
;
// in-memory only value, maintained right here
void
check_and_set_read_free_rpl_table
();
/* Number of indexes */
...
...
@@ -1139,6 +1136,10 @@ class Rdb_tbl_def {
const
std
::
string
&
base_tablename
()
const
{
return
m_tablename
;
}
const
std
::
string
&
base_partition
()
const
{
return
m_partition
;
}
GL_INDEX_ID
get_autoincr_gl_index_id
();
time_t
get_create_time
();
std
::
atomic
<
time_t
>
m_update_time
;
// in-memory only value
private:
const
time_t
CREATE_TIME_UNKNOWN
=
1
;
// CREATE_TIME_UNKNOWN means "didn't try to read, yet"
...
...
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