MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / close

Method close

sql/log.cc:902–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900*/
901
902void MYSQL_LOG::close(uint exiting)
903{ // One can't set log_type here!
904 DBUG_ENTER("MYSQL_LOG::close");
905 DBUG_PRINT("enter",("exiting: %d", (int) exiting));
906 if (log_state == LOG_OPENED)
907 {
908 end_io_cache(&log_file);
909
910 if (mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error)
911 {
912 char errbuf[MYSYS_STRERROR_SIZE];
913 write_error= 1;
914 sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno,
915 my_strerror(errbuf, sizeof(errbuf), errno));
916 }
917
918 if (mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
919 {
920 char errbuf[MYSYS_STRERROR_SIZE];
921 write_error= 1;
922 sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno,
923 my_strerror(errbuf, sizeof(errbuf), errno));
924 }
925 }
926
927 log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
928 my_free(name);
929 name= NULL;
930 DBUG_VOID_RETURN;
931}
932
933/** This is called only once. */
934

Callers 2

reopen_general_logFunction · 0.80

Calls 4

end_io_cacheFunction · 0.85
sql_print_errorFunction · 0.85
my_strerrorFunction · 0.85
my_freeFunction · 0.85

Tested by

no test coverage detected