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

Sparse files are being created on thinly provisioned storage

    XMLWordPrintable

Details

    Description

      I just noticed that extending page_compressed tables will still create sparse files. The following patch could almost fix it. In the middle hunk for fil_ibd_create(), we have a chicken-and-egg problem that needs to be addressed:

      diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
      index c841eb79497..e8d36f24228 100644
      --- a/storage/innobase/fil/fil0fil.cc
      +++ b/storage/innobase/fil/fil0fil.cc
      @@ -577,7 +577,7 @@ fil_space_extend_must_retry(
       		os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift));
       
       	*success = os_file_set_size(node->name, node->handle, new_size,
      -				    space->is_compressed());
      +				    node->punch_hole == 1);
       
       	os_has_said_disk_full = *success;
       	if (*success) {
      @@ -2034,7 +2034,9 @@ fil_ibd_create(
       
       	if (!os_file_set_size(
       		path, file,
      -		os_offset_t(size) << srv_page_size_shift, is_compressed)) {
      +		os_offset_t(size) << srv_page_size_shift,
      +		is_compressed /* FIXME: punch_hole==1 is set only after
      +			      node->find_metadata() below */)) {
       		*err = DB_OUT_OF_FILE_SPACE;
       err_exit:
       		os_file_close(file);
      diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
      index 16250928845..0f016ba5f98 100644
      --- a/storage/innobase/log/log0recv.cc
      +++ b/storage/innobase/log/log0recv.cc
      @@ -841,7 +841,7 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
               goto fail;
             if (!os_file_set_size(node->name, node->handle,
                                   size * fil_space_t::physical_size(flags),
      -                            space->is_compressed()))
      +                            node->punch_hole == 1))
             {
               space->release();
               goto fail;
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              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.