82 Oldest_active_tracker.
m_history[
index] = { mvccid, tran_index, set_or_get, src };
96 lowest.store (mvccid);
103 MVCCID mvccid = lowest.load ();
104 #if !defined (NDEBUG) 117 , m_event_type (COMMIT)
145 crt_oldest_active = m_current_status_lowest_active_mvccid.load ();
146 if (crt_oldest_active >= next_oldest_active)
152 while (!m_current_status_lowest_active_mvccid.compare_exchange_strong (crt_oldest_active, next_oldest_active));
153 #if !defined (NDEBUG) 163 : m_transaction_lowest_visible_mvccids (
NULL)
164 , m_transaction_lowest_visible_mvccids_size (0)
166 , m_current_trans_status ()
167 , m_trans_status_history_position (0)
168 , m_trans_status_history (
NULL)
169 , m_new_mvccid_lock ()
170 , m_active_trans_mutex ()
172 , m_ov_lock_count (0)
227 MVCCID crt_status_lowest_active;
231 MVCCID highest_completed_mvccid;
236 UINT64 snapshot_wait_time;
237 UINT64 snapshot_retry_count = 0;
241 if (is_perf_tracking)
255 snapshot_retry_count++;
297 trans_status_version = trans_status.
m_version.load ();
310 if (trans_status_version == trans_status.
m_version.load ())
338 if (is_perf_tracking)
342 snapshot_wait_time = tv_diff.tv_sec * 1000000LL + tv_diff.tv_usec;
343 if (snapshot_wait_time > 0)
347 if (snapshot_retry_count > 1)
350 snapshot_retry_count - 1);
358 perf_utime_tracker perf;
360 PERF_UTIME_TRACKER_START (&threadr, &perf);
362 const size_t MVCC_OLDEST_ACTIVE_BUFFER_LENGTH = 32;
364 MVCCID loaded_tran_mvccid;
374 waiting_mvccids_pos.
append (idx);
378 lowest_active_mvccid = loaded_tran_mvccid;
382 size_t retry_count = 0;
383 while (waiting_mvccids_pos.
get_size () > 0)
386 if (retry_count % 20 == 0)
391 for (
size_t i = waiting_mvccids_pos.
get_size () - 1;
i < waiting_mvccids_pos.
get_size (); --
i)
393 size_t pos = waiting_mvccids_pos.
get_array ()[
i];
403 lowest_active_mvccid = loaded_tran_mvccid;
406 waiting_mvccids_pos.
erase (
i);
410 if (perf.is_perf_tracking)
420 return lowest_active_mvccid;
428 bool ret_active =
false;
450 next_trans_status.
m_version.store (next_version);
452 return next_trans_status;
524 if (global_lowest_active == mvccid
528 #if !defined (NDEBUG) 533 if (next_status.
m_version.load () == next_version)
MVCCID recent_snapshot_lowest_active_mvccid
MVCCID m_last_completed_mvccid
MVCCID highest_completed_mvccid
cubthread::entry * thread_get_thread_entry_info(void)
void reset_start_mvccid()
MVCCID update_global_oldest_visible()
static void oldest_active_set(mvcctable::lowest_active_mvccid_type &lowest, int tran_index, MVCCID mvccid, oldest_active_event::source src)
void unlock_global_oldest_visible()
void get_two_new_mvccid(MVCCID &first, MVCCID &second)
MVCC_SATISFIES_SNAPSHOT_RESULT mvcc_satisfies_snapshot(THREAD_ENTRY *thread_p, MVCC_REC_HEADER *rec_header, MVCC_SNAPSHOT *snapshot)
std::atomic< size_t > m_trans_status_history_position
bool is_global_oldest_visible_locked() const
int logtb_get_number_of_total_tran_indices(void)
int logtb_tran_update_all_global_unique_stats(THREAD_ENTRY *thread_p)
void advance_oldest_active(MVCCID next_oldest_active)
void thread_sleep(double millisec)
void reset_start_mvccid(MVCCID mvccid)
void build_mvcc_info(log_tdes &tdes)
std::atomic< version_type > m_version
struct timeval TSCTIMEVAL
MVCCID compute_oldest_visible_mvccid() const
void tsc_elapsed_time_usec(TSCTIMEVAL *tv, TSC_TICKS end_tick, TSC_TICKS start_tick)
static void oldest_active_add_event(MVCCID mvccid, int tran_index, oldest_active_event::op_type set_or_get, oldest_active_event::source src)
MVCCID lowest_active_mvccid
void complete_mvcc(int tran_index, MVCCID mvccid, bool committed)
const size_t OLDEST_ACTIVE_HISTORY_SIZE
void reset_active_transactions()
static MVCCID oldest_active_get(const mvcctable::lowest_active_mvccid_type &lowest, int tran_index, oldest_active_event::source src)
#define MVCCID_ALL_VISIBLE
size_t get_size(void) const
#define MVCCID_IS_NORMAL(id)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
oldest_active_event m_history[OLDEST_ACTIVE_HISTORY_SIZE]
std::atomic< MVCCID > m_oldest_visible
void set_inactive_mvccid(MVCCID mvccid)
MVCCID compute_highest_completed_mvccid() const
bool is_active(MVCCID mvccid) const
#define ER_MVCC_CANT_GET_SNAPSHOT
static const size_t HISTORY_MAX_SIZE
oldest_active_history_tracker Oldest_active_tracker
mvcc_active_tran m_active_mvccs
size_t m_transaction_lowest_visible_mvccids_size
std::mutex m_new_mvccid_lock
void tsc_getticks(TSC_TICKS *tck)
STATIC_INLINE bool perfmon_is_perf_tracking(void) __attribute__((ALWAYS_INLINE))
std::atomic< MVCCID > lowest_active_mvccid_type
#define MVCC_ID_PRECEDES(id1, id2)
mvcc_trans_status * m_trans_status_history
static int logtb_load_global_statistics_to_tran(THREAD_ENTRY *thread_p)
lowest_active_mvccid_type m_current_status_lowest_active_mvccid
MVCCID get_global_oldest_visible() const
int m_tran_index_or_global
mvcc_trans_status & next_trans_status_start(mvcc_trans_status::version_type &next_version, size_t &next_index)
void lock_global_oldest_visible()
unsigned int version_type
MVCCID get_bit_area_start_mvccid()
mvcc_trans_status m_current_trans_status
static const size_t HISTORY_INDEX_MASK
void append(const T &source)
MVCCID compute_lowest_active_mvccid() const
void reset_transaction_lowest_active(int tran_index)
bool is_active(MVCCID mvccid) const
void alloc_transaction_lowest_active()
void copy_to(mvcc_active_tran &dest, copy_safety safety) const
STATIC_INLINE void perfmon_add_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid, UINT64 amount) __attribute__((ALWAYS_INLINE))
MVCC_SNAPSHOT_FUNC snapshot_fnc
lowest_active_mvccid_type * m_transaction_lowest_visible_mvccids
std::mutex m_active_trans_mutex
void next_tran_status_finish(mvcc_trans_status &next_trans_status, size_t next_index)
oldest_active_event & operator=(const oldest_active_event &other)
#define MVCCID_FORWARD(id)
std::atomic< size_t > m_event_count
mvcc_active_tran m_active_mvccs
#define MVCCID_IS_VALID(id)
const T * get_array(void) const
void complete_sub_mvcc(MVCCID mvccid)
std::atomic< size_t > m_ov_lock_count