The thread between the parts that require mutual exclusion (lock table, page buffer, and access / modification of the operation) was designated as a critical section.
The critical section has been defined as follows.
| CSECT_ER_LOG_FILE | Latch for error msg log file |
| CSECT_ER_MSG_CACHE | Latch for error msg cache |
| CSECT_WFG | Latch for wait-for-graph |
| CSECT_LOG | Latch for log manager |
| CSECT_LOCATOR_SR_CLASSNAME_TABLE | Latch for temp classname to classOID entries |
| CSECT_FILE_NEWFILE | Latch related to new file table |
| CSECT_QPROC_QUERY_TABLE | Latch for query manager table |
| CSECT_QPROC_QFILE_PGCNT | Latch for query file page count |
| CSECT_QPROC_XASL_CACHE | Latch for XASL cache (mht: memory hash table) |
| CSECT_QPROC_LIST_CACHE | Latch for query result(list file) cache (mht) |
| CSECT_BOOT_SR_DBPARM | Latch for accessing System Database parameters. Used during vol creation |
| CSECT_DISK_REFRESH_GOODVOL | Latch for refreshing good volume cache |
| CSECT_CNV_FMT_LEXER | Latch for value/string format translation lexer |
| CSECT_HEAP_CHNGUESS | Latch for schema change |
| CSECT_SPAGE_SAVESPACE | Latch for slotted page saving space |
| CSECT_TRAN_TABLE | Latch for transaction table |
| CSECT_CT_OID_TABLE | |
| CSECT_SCANID_BITMAP | |
| CSECT_LOG_FLUSH | for 2 flushing (by LFT, by normal thread) |
| CSECT_HA_SERVER_STATE | Latch for HA server mode change |
| CSECT_LAST |
The critical section with the following data structures and operations has been implemented.
typedef struct css_critical_section { const char *name; MUTEX_T lock; /* read/write monitor lock */ int rwlock; /* >0 = # readers, <0 = writer, 0 = none */ unsigned int waiting_writers; /* # of waiting writers */ COND_T readers_ok; /* start waiting readers */ THREAD_ENTRY *waiting_writers_queue; /* queue of waiting writers */ THREAD_ENTRY *waiting_promoters_queue; /* queue of waiting promoters */ THREAD_T owner; /* CS owner writer */ int tran_index; /* transaction id acquiring CS */ unsigned int total_enter; unsigned int total_nwaits; /* total # of waiters */ struct timeval max_wait; struct timeval total_wait; } CSS_CRITICAL_SECTION; CSS_CRITICAL_SECTION css_Csect_array[CRITICAL_SECTION_COUNT];