Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL:MGR Learning (2): the writing process of Write set (write set)

Shulou Source: shulou.com Published: 2022-06-01 06:22:17 10月07日 Update

< iterator; i++) { uchar buff[BUFFER_READ_PKE]; int8store(buff, set->

Write_ set [I]); / / copy byte by byte to buffer uint64 const tmp_str_sz= base64_needed_encoded_length ((uint64) BUFFER_READ_PKE); char * write_set_value= (char *) my_malloc (PSI_NOT_INSTRUMENTED, static_cast (tmp_str_sz), MYF (MY_WME)) / / 13bytes (gdb) p tmp_str_sz $2 = 13 if (! write_set_value) / / memory allocation error {/ * purecov: begin inspected * / log_message (MY_ERROR_LEVEL, "No memory to generate write identification hash"); DBUG_RETURN (1) / * purecov: end * /} if (base64_encode (buff, (size_t) BUFFER_READ_PKE, write_set_value) / / do base64 algorithm {/ * purecov: begin inspected * / log_message (MY_ERROR_LEVEL, "Base64 encoding of the write identification hash failed"); DBUG_RETURN (1) / * purecov: end * /} tcle- > add_write_set (write_set_value); / / finally write write set in base64 format to event} DBUG_RETURN (0);} 3. Get_transaction_write_set function Transaction_write_set* get_transaction_write_set (unsigned long m_thread_id) {DBUG_ENTER ("get_transaction_write_set"); THD * thd= NULL; Transaction_write_set* result_set= NULL Find_thd_with_id find_thd_with_id (m_thread_id, false); thd= Global_THD_manager::get_instance ()-> find_thd (& find_thd_with_id); if (thd) {std::set * write_set= thd- > get_transaction ()-> get_transaction_write_set_ctx ()-> get_write_set (); / / Rpl_transaction_write_set_ctx std::set * get_write_set () Unsigned long write_set_size= write_set- > size (); / / returns the collection size if (write_set_size= = 0) {mysql_mutex_unlock (& thd- > LOCK_thd_data); DBUG_RETURN (NULL) } result_set= (Transaction_write_set*) my_malloc (key_memory_write_set_extraction, sizeof (Transaction_write_set), MYF (0)); / / memory space result_set- > write_set_size= write_set_size is allocated for its Transaction_write_set here / / get size result_set- > write_set= (unsigned long long*) my_malloc (key_memory_write_set_extraction, write_set_size * sizeof (unsigned long long), MYF (0)); / / allocate memory int result_set_index= 0 For (std::set::iterator it= write_set- > begin (); / / copy from set to simple memory it! = write_set- > end (); + + it) {uint64 temp= * it; result_set- > write_ set [result _ set_index++] = temp;} mysql_mutex_unlock (& thd- > LOCK_thd_data);} DBUG_RETURN (result_set);}

Author Wechat:

Tags: Generation thing memory procedure type content function storage authentication space broadcast learning that is location variable simultaneous byte array source code result Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux Shulou Technology OPPO Reno Shulou Information