| 9720 | |
| 9721 | |
| 9722 | int Event_log::write_cache_raw(THD *thd, IO_CACHE *cache) |
| 9723 | { |
| 9724 | DBUG_ENTER("Event_log::write_cache_raw"); |
| 9725 | mysql_mutex_assert_owner(&LOCK_log); |
| 9726 | if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) |
| 9727 | DBUG_RETURN(ER_ERROR_ON_WRITE); |
| 9728 | |
| 9729 | IO_CACHE *file= get_log_file(); |
| 9730 | IF_DBUG(size_t total= cache->end_of_file,); |
| 9731 | |
| 9732 | /* |
| 9733 | Note that for the first loop there is nothing to write if |
| 9734 | the full file fits into the cache. |
| 9735 | */ |
| 9736 | do |
| 9737 | { |
| 9738 | size_t read_len= cache->read_end - cache->read_pos; |
| 9739 | int res= my_b_safe_write(file, cache->read_pos, read_len); |
| 9740 | if (unlikely(res)) |
| 9741 | DBUG_RETURN(res); |
| 9742 | IF_DBUG(total-= read_len,); |
| 9743 | } while (my_b_fill(cache)); |
| 9744 | DBUG_ASSERT(total == 0); |
| 9745 | DBUG_RETURN(0); |
| 9746 | } |
| 9747 | |
| 9748 | /* |
| 9749 | Write the contents of a cache to the binary log. |
no test coverage detected