Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-39087

os_file_set_size() may behave inconsistently during server shutdown

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      In the MDEV-37949 development branch, the test innodb.log_archive is failing on FreeBSD because posix_fallocate() would return EOPNOTSUPP and the pwrite based fallback would fail the operation unless the following condition is not removed:

      diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
      index 8cf761545f3..72f6bab82f9 100644
      --- a/storage/innobase/os/os0file.cc
      +++ b/storage/innobase/os/os0file.cc
      @@ -1606,8 +1606,7 @@ bool os_file_set_size(const char *name, os_file_t file, os_offset_t size,
       	/* Write buffer full of zeros */
       	memset(buf, 0, buf_size);
       
      -	while (current_size < size
      -	       && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
      +	while (current_size < size) {
       		ulint	n_bytes;
       
       		if (size - current_size < (os_offset_t) buf_size) {
      

      I don’t see a reason to abort any file extension operation during shutdown. In MDEV-37949 the scenario for hitting this is as follows:

      1. A zero-length innodb_log_archive file is artificially created by the test case, to simulate a crash during a code path where a new log file is being written.
      2. The server is started and shut down.
      3. On shutdown, the checkpoint is expected to be written to the log file that had been created incompletely.
      4. Because of the above faulty logic, the attempt to extend the file would fail and the server would intentionally crash.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Marko Mäkelä Marko Mäkelä
              Thirunarayanan Balathandayuthapani Thirunarayanan Balathandayuthapani
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.