summaryrefslogtreecommitdiff
path: root/storage/innobase/include/data0data.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/data0data.h')
-rw-r--r--storage/innobase/include/data0data.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h
index db321626368..fbbdd3b8f2d 100644
--- a/storage/innobase/include/data0data.h
+++ b/storage/innobase/include/data0data.h
@@ -491,6 +491,22 @@ struct dfield_t{
@param[in,out] heap memory heap in which the clone will be created
@return the cloned object */
dfield_t* clone(mem_heap_t* heap) const;
+
+ /** @return system field indicates history row */
+ bool vers_history_row() const
+ {
+ ut_ad(type.vers_sys_end());
+ if (type.mtype == DATA_FIXBINARY) {
+ ut_ad(len == sizeof timestamp_max_bytes);
+ return 0 != memcmp(data, timestamp_max_bytes, len);
+ } else {
+ ut_ad(type.mtype == DATA_INT);
+ ut_ad(len == sizeof trx_id_max_bytes);
+ return 0 != memcmp(data, trx_id_max_bytes, len);
+ }
+ ut_ad(0);
+ return false;
+ }
};
/** Structure for an SQL data tuple of fields (logical record) */
@@ -519,6 +535,16 @@ struct dtuple_t {
/** Value of dtuple_t::magic_n */
# define DATA_TUPLE_MAGIC_N 65478679
#endif /* UNIV_DEBUG */
+
+ /** Trim the tail of an index tuple before insert or update.
+ After instant ADD COLUMN, if the last fields of a clustered index tuple
+ match the default values that were explicitly specified or implied
+ during ADD COLUMN, there will be no need to store them.
+ NOTE: A page latch in the index must be held, so that the index
+ may not lose 'instantness' before the trimmed tuple has been
+ inserted or updated.
+ @param[in] index index possibly with instantly added columns */
+ void trim(const dict_index_t& index);
};
inline ulint dtuple_get_n_fields(const dtuple_t* tuple)
@@ -536,7 +562,11 @@ inline const void* dfield_get_data(const dfield_t* field)
ut_ad(field->len == UNIV_SQL_NULL || field->data != &data_error);
return field->data;
}
-inline ulint dfield_get_len(const dfield_t* field) { return field->len; }
+inline ulint dfield_get_len(const dfield_t* field) {
+ ut_ad(field->len == UNIV_SQL_NULL || field->data != &data_error);
+ ut_ad(field->len != UNIV_SQL_DEFAULT);
+ return field->len;
+}
inline bool dfield_is_null(const dfield_t* field)
{ return field->len == UNIV_SQL_NULL; }
/** @return whether a column is to be stored off-page */