/* Transaction rollback segment header */ /*-------------------------------------------------------------*/ #define TRX_RSEG_MAX_SIZE 0 /* Maximum allowed size for rollback segment in pages */ #define TRX_RSEG_HISTORY_SIZE 4 /* Number of file pages occupied by the logs in the history list */ #define TRX_RSEG_HISTORY 8 /* The update undo logs for committed transactions */ #define TRX_RSEG_FSEG_HEADER (8 + FLST_BASE_NODE_SIZE) /* Header for the file segment where this page is placed */ #define TRX_RSEG_UNDO_SLOTS (8 + FLST_BASE_NODE_SIZE + FSEG_HEADER_SIZE) /* Undo log segment slots */ /* Number of undo log slots in a rollback segment file copy */ #define TRX_RSEG_N_SLOTS (UNIV_PAGE_SIZE / 16) /* Maximum number of transactions supported by a single rollback segment */ #define TRX_RSEG_MAX_N_TRXS (TRX_RSEG_N_SLOTS / 2) /* The rollback segment memory object */ struct trx_rseg_struct{ /*--------------------------------------------------------*/ ulint id; /*!< rollback segment id == the index of its slot in the trx system file copy */ mutex_t mutex; /*!< mutex protecting the fields in this struct except id, which is constant */ ulint space; /*!< space where the rollback segment is header is placed */ ulint zip_size;/* compressed page size of space in bytes, or 0 for uncompressed spaces */ ulint page_no;/* page number of the rollback segment header */ ulint max_size;/* maximum allowed size in pages */ ulint curr_size;/* current size in pages */ /*--------------------------------------------------------*/ /* Fields for update undo logs */ UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_list; /* List of update undo logs */ UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_cached; /* List of update undo log segments cached for fast reuse */ /*--------------------------------------------------------*/ /* Fields for insert undo logs */ UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_list; /* List of insert undo logs */ UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_cached; /* List of insert undo log segments cached for fast reuse */ /*--------------------------------------------------------*/ ulint last_page_no; /*!< Page number of the last not yet purged log header in the history list; FIL_NULL if all list purged */ ulint last_offset; /*!< Byte offset of the last not yet purged log header */ trx_id_t last_trx_no; /*!< Transaction number of the last not yet purged log */ ibool last_del_marks; /*!< TRUE if the last not yet purged log needs purging */ /*--------------------------------------------------------*/ UT_LIST_NODE_T(trx_rseg_t) rseg_list; /* the list of the rollback segment memory objects */ }; /** The offset of the undo log page header on pages of the undo log */ #define TRX_UNDO_PAGE_HDR FSEG_PAGE_DATA /*-------------------------------------------------------------*/ /** Transaction undo log page header offsets */ /* @{ */ #define TRX_UNDO_PAGE_TYPE 0 /*!< TRX_UNDO_INSERT or TRX_UNDO_UPDATE */ #define TRX_UNDO_PAGE_START 2 /*!< Byte offset where the undo log records for the LATEST transaction start on this page (remember that in an update undo log, the first page can contain several undo logs) */ #define TRX_UNDO_PAGE_FREE 4 /*!< On each page of the undo log this field contains the byte offset of the first free byte on the page */ #define TRX_UNDO_PAGE_NODE 6 /*!< The file list node in the chain of undo log pages */ /*-------------------------------------------------------------*/ #define TRX_UNDO_PAGE_HDR_SIZE (6 + FLST_NODE_SIZE) /*!< Size of the transaction undo log page header, in bytes */ /* 一個 undo log record主要有下面幾部分 1。2 bytes for the pointer to the next undo log record,當不存在時,預留這部分空間 2。1 byte for some general parameters to the undo log #define TRX_UNDO_INSERT_REC 11 /* fresh insert into clustered index */ #define TRX_UNDO_UPD_EXIST_REC 12 /* update of a non-delete-marked record */ #define TRX_UNDO_UPD_DEL_REC 13 /* update of a delete marked record to a not delete marked record; also the fields of the record can change */ #define TRX_UNDO_DEL_MARK_REC 14 /* delete marking of a record; fields do not change */ #define TRX_UNDO_CMPL_INFO_MULT 16 /* compilation info is multiplied by this and ORed to the type above */ 3。undo_no 4。table id 5。1 byte for the state of the info bits 6。trx id 7。Store then the fields required to uniquely determine the record which will be modified in the clustered index 8。Save to the undo log the old values of the columns to be updated 9。In the case of a delete marking, and also in the case of an update where any ordering field of any index changes, store the values of all columns which occur as ordering fields in any index. This info is used in the purge of old versions where we use it to build and search the delete marked index records, to look if we can remove them from the index tree. 10。Write pointers to the previous and the next undo log records */ /** Transaction undo log memory object; this is protected by the undo_mutex in the corresponding transaction object */ struct trx_undo_struct{ /*-----------------------------*/ ulint id; /*!< undo log slot number within the rollback segment */ ulint type; /*!< TRX_UNDO_INSERT or TRX_UNDO_UPDATE */ ulint state; /*!< state of the corresponding undo log segment */ ibool del_marks; /*!< relevant only in an update undo log: this is TRUE if the transaction may have delete marked records, because of a delete of a row or an update of an indexed field; purge is then necessary; also TRUE if the transaction has updated an externally stored field */ trx_id_t trx_id; /*!< id of the trx assigned to the undo log */ XID xid; /*!< X/Open XA transaction identification */ ibool dict_operation; /*!< TRUE if a dict operation trx */ table_id_t table_id; /*!< if a dict operation, then the table id */ trx_rseg_t* rseg; /*!< rseg where the undo log belongs */ /*-----------------------------*/ ulint space; /*!< space id where the undo log placed */ ulint zip_size; /*!< compressed page size of space in bytes, or 0 for uncompressed */ ulint hdr_page_no; /*!< page number of the header page in the undo log */ ulint hdr_offset; /*!< header offset of the undo log on the page */ ulint last_page_no; /*!< page number of the last page in the undo log; this may differ from top_page_no during a rollback */ ulint size; /*!< current size in pages */ /*-----------------------------*/ ulint empty; /*!< TRUE if the stack of undo log records is currently empty */ ulint top_page_no; /*!< page number where the latest undo log record was catenated; during rollback the page from which the latest undo record was chosen */ ulint top_offset; /*!< offset of the latest undo record, i.e., the topmost element in the undo log if we think of it as a stack */ undo_no_t top_undo_no; /*!< undo number of the latest record */ buf_block_t* guess_block; /*!< guess for the buffer block where the top page might reside */ /*-----------------------------*/ UT_LIST_NODE_T(trx_undo_t) undo_list; /*!< undo log objects in the rollback segment are chained into lists */ }; /** The undo log header. There can be several undo log headers on the first page of an update undo log segment. 每一條元組都有這麼一條記錄頭*/ /* @{ */ /*-------------------------------------------------------------*/ #define TRX_UNDO_TRX_ID 0 /*!< Transaction id */ #define TRX_UNDO_TRX_NO 8 /*!< Transaction number of the transaction; defined only if the log is in a history list */ #define TRX_UNDO_DEL_MARKS 16 /*!< Defined only in an update undo log: TRUE if the transaction may have done delete markings of records, and thus purge is necessary */ #define TRX_UNDO_LOG_START 18 /*!< Offset of the first undo log record of this log on the header page; purge may remove undo log record from the log start, and therefore this is not necessarily the same as this log header end offset */ #define TRX_UNDO_XID_EXISTS 20 /*!< TRUE if undo log header includes X/Open XA transaction identification XID */ #define TRX_UNDO_DICT_TRANS 21 /*!< TRUE if the transaction is a table create, index create, or drop transaction: in recovery the transaction cannot be rolled back in the usual way: a 'rollback' rather means dropping the created or dropped table, if it still exists */ #define TRX_UNDO_TABLE_ID 22 /*!< Id of the table if the preceding field is TRUE */ #define TRX_UNDO_NEXT_LOG 30 /*!< Offset of the next undo log header on this page, 0 if none */ #define TRX_UNDO_PREV_LOG 32 /*!< Offset of the previous undo log header on this page, 0 if none */ #define TRX_UNDO_HISTORY_NODE 34 /*!< If the log is put to the history list, the file list node is here */ /*-------------------------------------------------------------*/ /** Size of the undo log header without XID information */ #define TRX_UNDO_LOG_OLD_HDR_SIZE (34 + FLST_NODE_SIZE) //insert undo 記錄的內容 /* Reserve 2 bytes for the pointer to the next undo log record */ ptr += 2; /* Store first some general parameters to the undo log */ *ptr++ = TRX_UNDO_INSERT_REC; ptr += mach_ull_write_much_compressed(ptr, trx->undo_no); ptr += mach_ull_write_much_compressed(ptr, index->table->id); /*----------------------------------------*/ /* Store then the fields required to uniquely determine the record to be inserted in the clustered index */ //update undo 記錄的內容 /* Store the state of the info bits */ /* Store the values of the system columns */ /* Store then the fields required to uniquely determine the record which will be modified in the clustered index */ /* Save to the undo log the old values of the columns to be updated. 格式:總個數 | 第一個修改列的位置 | 長度 | 內容 | 第二個修改列的位置 | 。。。 */ /* In the case of a delete marking, and also in the case of an update where any ordering field of any index changes, store the values of all columns which occur as ordering fields in any index. This info is used in the purge of old versions where we use it to build and search the delete marked index records, to look if we can remove them from the index tree. Note that starting from 4.0.14 also externally stored fields can be ordering in some index. Starting from 5.2, we no longer store REC_MAX_INDEX_COL_LEN first bytes to the undo log record, but we can construct the column prefix fields in the index by fetching the first page of the BLOB that is pointed to by the clustered index. This works also in crash recovery, because all pages (including BLOBs) are recovered before anything is rolled back. */ //把對undo log的修改記錄在redo log之中, //元組中記錄的組成 roll_ptr = (roll_ptr_t) is_insert << 55 | (roll_ptr_t) rseg_id << 48 | (roll_ptr_t) page_no << 16 | offset;
轉載自劉茫茫看山 問題背景 某天我們的租戶反饋數據庫連接缺少必要的驅動,我們通過日誌查看確實是缺少部分數據庫的驅動,因爲DolphinScheduler默認只帶了Oracle和MySQL的驅動,並且需要將pom文件中的test模式去掉纔可以
社區王牌專欄《一問一實驗:AI 版》全新改版歸來,得到了新老讀者們的關注。其中不乏對 ChatDBA 感興趣的讀者前來諮詢,表達了想試用體驗 ChatDBA 的意願,對此我們表示感謝 🤟。 目前,ChatDBA 還在最後的準備階段,會盡快跟
在迅速變化的技術領域,本地環境的搭建和調試對於軟件開發的效率和效果至關重要。本文將詳細介紹如何爲Apache DolphinScheduler搭建一個高效的本地開發環境,包括2.x和3.x版本的設置方法。 無論您是初學者還是有經驗的開發者
本文分享自華爲雲社區《【MySQL技術專欄】MySQL8.0直方圖介紹》,作者:GaussDB 數據庫。 背景 數據庫查詢優化器負責將SQL查詢轉換爲儘可能高效的執行計劃,但因爲數據環境不斷變化導致優化器對查詢數據瞭解的不夠充足,可能無法
作者:vivo 互聯網數據庫團隊- Qiu Xinbo 本文主要通過圖示介紹了用主鍵進行分片查詢的過程,介紹了主鍵分頁查詢存在SQL性能問題,如何去創建高效的索引去優化主鍵分頁查詢的SQL性能問題 對於數據分佈不均
您可以在這裏檢查和比較這兩種排序規則提供的排序順序: https://collation-charts.org/mysql60/mysql604.utf8_unicode_ci.european.html https://collation
本文分享自華爲雲社區《KubeEdge v1.17.0發佈!數據處理能力與易用性全面提升》 ,作者: 雲容器大未來。 KubeEdge社區v1.17.0 版本正式發佈。新版本爲邊緣節點和設備帶來了更多的新能力,同時持續在易用性上
InnoDB 有哪幾種行鎖,其中比較特殊的插入意向鎖爲什麼而存在? 作者:操盛春,愛可生技術專家,公衆號『一樹一溪』作者,專注於研究 MySQL 和 OceanBase 源碼。 愛可生開源社區出品,原創內容未經授權不得隨意使用,轉載請聯繫
拿到這個網站,通過對比查詢,我們發現 閉合參數 finsh 時,查詢出的內容更多 經過進一步判斷,確實存在漏洞 不過在測試的時候發現存在一定的過濾 但是可以通過內聯註釋進行繞過。 這裏也是加深瞭解了內聯註釋的知識點,之前只會簡單的
在生產環境中經常會有一些隱式類型轉換導致SQL索引失效,性能極差,進而影響影響集羣負載和業務的情況。本文總結了隱式轉換常見的場景,在生產中要儘量避免 SQL 隱式轉換的出現。 作者:張洛丹,熱衷於數據庫技術,不斷探索,期望未來能夠撰寫更有
一般我們在Linux下執行某些外部程序的時候可能會提示找不到共享庫的錯誤, 比如: tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open sha
🥳 社區王牌專欄《一問一實驗:AI 版》全新歸來,在 520 這個充滿愛的特殊日子裏,獻上一份屬於 DBA 們的愛(AI)。 什麼是《一問一實驗》? 《一問一實驗》是愛可生開源社區的王牌專欄。每一期通過一個數據庫問題對應一組實驗的形式,
一、背景 上週小組有個需求上線牽扯9個應用(小組目前維護了26個服務,由於團隊系統業務屬性特徵基於高可用、高性能原則拆分,有些是合理的,有些不是很合理的),同時上週OpsReview的一個微服務濫用典範案例(Promise服務A調用服務B,
本文分享自華爲雲社區《MySQL全文索引源碼剖析之Insert語句執行過程》 ,作者:GaussDB 數據庫。 1. 背景介紹 全文索引是信息檢索領域的一種常用的技術手段,用於全文搜索問題,即根據單詞,搜索包含該單詞的文檔,比如在瀏覽器
Metabase 是一款開源的數據分析和商業智能工具,允許企業用戶在幾分鐘內搭建起一個功能完善的數據探索和數據分析平臺,不需要編寫複雜的 SQL 查詢語句或者使用專業的數據可視化工具,就可以輕鬆地探索數據、創建圖表、構建儀表盤,從而洞察業務