1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-17171: RocksDB Tables do not have "Creation Date"

- Add SLEEP() calls to the testcase to make it really test that the
  time doesn't change.
- Always use .frm file creation time as a creation timestamp (attempts
  to re-use older create_time when the table DDL changes are not good
  because then create_time will change after server restart)
- Use the same method names as the upstream patch does
- Use std::atomic for m_update_time
This commit is contained in:
Sergei Petrunia
2019-11-01 21:40:10 +03:00
parent 9c72963d2a
commit 9c6fec88b1
5 changed files with 60 additions and 13 deletions

View File

@@ -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"