天天看點

Postgres-xl GTM(全局事務管理器 Globale Transaction Manager)Seq 管理器

Seq Manager

GTM_InitSeqManager初始化序列管理器

Postgres-xl GTM(全局事務管理器 Globale Transaction Manager)Seq 管理器
void GTM_InitSeqManager(void) {
  int ii;
  for (ii = 0; ii < SEQ_HASH_TABLE_SIZE; ii++){
    GTMSequences[ii].shb_list = gtm_NIL;
    GTM_RWLockInit(&GTMSequences[ii].shb_lock);
  }
}      

static GTM_SeqInfo *seq_find_seqinfo(GTM_SequenceKey seqkey)通過鍵查找GTM_SeqInfo值

static int seq_release_seqinfo(GTM_SeqInfo *seqinfo)擷取seqinfo->gs_lock鎖,将引用計數seqinfo->gs_ref_count減少,如果seqinfo->gs_state為SEQ_STATE_DELETED且引用計數為零的情況,需要使用seq_remove_seqinfo從序列管理器GTMSequences删除該GTM_SeqInfo,釋放seqinfo->gs_lock鎖。

繼續閱讀