restore Field::get_timestamp() prototype

This commit is contained in:
Sergei Golubchik 2017-11-30 16:10:35 +01:00 committed by Aleksey Midenkov
parent 30841c0382
commit a46f585aa7
5 changed files with 21 additions and 16 deletions

View file

@ -5397,15 +5397,8 @@ my_time_t Field_timestampf::get_timestamp(const uchar *pos,
ulong *sec_part) const
{
struct timeval tm;
if (sec_part)
{
my_timestamp_from_binary(&tm, pos ? pos : ptr, dec);
*sec_part= tm.tv_usec;
}
else
{
my_timestamp_from_binary(&tm, pos ? pos : ptr, 0);
}
my_timestamp_from_binary(&tm, pos, dec);
*sec_part= tm.tv_usec;
return tm.tv_sec;
}

View file

@ -1008,8 +1008,12 @@ public:
}
bool set_explicit_default(Item *value);
virtual my_time_t get_timestamp(const uchar *pos= NULL, ulong *sec_part= NULL) const
virtual my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const
{ DBUG_ASSERT(0); return 0; }
my_time_t get_timestamp(ulong *sec_part) const
{
return get_timestamp(ptr, sec_part);
}
/**
Evaluates the @c UPDATE default function, if one exists, and stores the
@ -2509,7 +2513,7 @@ public:
return res;
}
/* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
virtual my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
my_time_t get_timestamp(ulong *sec_part) const
{
return get_timestamp(ptr, sec_part);
@ -2641,7 +2645,11 @@ public:
void set_max();
bool is_max();
void store_TIME(my_time_t timestamp, ulong sec_part);
my_time_t get_timestamp(const uchar *pos= NULL, ulong *sec_part= NULL) const;
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
my_time_t get_timestamp(ulong *sec_part) const
{
return get_timestamp(ptr, sec_part);
}
uint size_of() const { return sizeof(*this); }
};

View file

@ -12509,9 +12509,10 @@ Rows_log_event::write_row(rpl_group_info *rgi,
// Set vers fields when replicating from not system-versioned table.
if (m_type == WRITE_ROWS_EVENT_V1 && table->versioned_by_sql())
{
ulong sec_part;
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
// Check whether a row came from unversioned table and fix vers fields.
if (table->vers_start_field()->get_timestamp() == 0)
if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
{
bitmap_set_bit(table->write_set, table->vers_start_field()->field_index);
bitmap_set_bit(table->write_set, table->vers_end_field()->field_index);

View file

@ -130,14 +130,16 @@ public:
my_time_t min_time()
{
mysql_rwlock_rdlock(&lock);
my_time_t res= min_value.get_timestamp();
ulong sec_part;
my_time_t res= min_value.get_timestamp(&sec_part);
mysql_rwlock_unlock(&lock);
return res;
}
my_time_t max_time()
{
mysql_rwlock_rdlock(&lock);
my_time_t res= max_value.get_timestamp();
ulong sec_part;
my_time_t res= max_value.get_timestamp(&sec_part);
mysql_rwlock_unlock(&lock);
return res;
}

View file

@ -3197,8 +3197,9 @@ int vers_get_partition_id(partition_info *part_info,
table->s->busy_rotation= true;
mysql_mutex_unlock(&table->s->LOCK_rotation);
// transaction is not yet pushed to VTQ, so we use now-time
ulong sec_part;
my_time_t end_ts= sys_trx_end->table->versioned_by_engine() ?
my_time_t(0) : sys_trx_end->get_timestamp();
my_time_t(0) : sys_trx_end->get_timestamp(&sec_part);
if (part_info->vers_limit_exceed() || part_info->vers_interval_exceed(end_ts))
{
part_info->vers_part_rotate(thd);