← Back to team overview

pbxt-discuss team mailing list archive

Re: Transaction id

 

Hi Brian,

Internally, PBXT uses a 32-bit transaction ID, but this value can wrap around of course.

So better is the current transaction log offset. This is a 64-bit value consisting of log ID and log offset.

The value is global, and can be retrieved (directly from ha_pbxt.cc) as follows:

uint64_t id;
xtLogID log_id;
xtLogOffset log_offset;  // This is an off_t value

if (pbxt_database) {
  XTDatabaseLog *db_log = &pbxt_database->db_xlog;
  xt_lck_slock(&db_log->xl_buffer_lock);
  req_flush_log_id = db_log->xl_append_log_id;
req_flush_log_offset = db_log->xl_append_log_offset + db_log- >xl_append_buf_pos;
  xt_spinlock_unlock(&db_log->xl_buffer_lock);
  // How the bits are divided depends on the pbxt_log_file_threshold
  // But this should work for most cases:
id = ((uint64_t) (log_id % 0x0000FFFF)) << 48 | (uint64_t) log_offset;
}

pbxt_database->db_xlog.xl_append_log_id
pbxt_database->db_xlog.xl_append_log_offset + pbxt_database- >db_xlog.xl_append_buf_pos

On Oct 7, 2010, at 4:02 AM, Brian Aker wrote:

Hi!

Is there anything like a transaction id, namely some sort of uint64_t that increments, that I could pull out of PBXT via an API call?

Thanks,
	-Brian
_______________________________________________
Mailing list: https://launchpad.net/~pbxt-discuss
Post to     : pbxt-discuss@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~pbxt-discuss
More help   : https://help.launchpad.net/ListHelp




References