Hi Roberts,

Yesterday, replied to your comments and still, it shows in the draft
mode!

We have a dedicated NFS mount and we are calculating disk size instead
of going through all directories as this takes forever.

For some, it might be possible that they are using shared directories
and this will not give correct disk usage.

Just tested using Robert's GetDirectorySize logic and same behaviour
[INF] 64 (lib/cron.php:549) Skipping long-running cron job 
core_cron_site_data_daily (Wed, 26 Feb 2020 11:57:01 +1000).

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1864760

Title:
  Disk usage calculation is very slow with NFS

Status in Mahara:
  New

Bug description:
  
https://mahara.org/interaction/forum/topic.php?id=8585&offset=0&limit=10#post34233

  We experienced a very strange issue while upgrading from Mahara
  18.10.3 to 19.10.1. It was stuck at cron_site_data_daily() in the
  htdocs\lib\db\upgrade.php, taking forever to calculate disk usage and
  failing the upgrade process after 10 minutes. It was opening the
  database transaction and waiting forever for dirsize function to
  finish.

      if ($oldversion < 2019011500) {

          log_debug('run cron_site_data_daily function to update data
  with new chartjs structure');

          cron_site_data_daily();

      }

  The cron job call the same function and it is stuck for a very long
  time due to the same reasons.

  We believe this is an NFS file locking issue. The data root is mounted
  on an NFS volume,  and it is around 500 GB. Even the Linux du utility
  takes around 20 minutes to calculate the size of this NFS mount point.

  We fixed this issue by swapping the dirsize function
  (htdocs\lib\function.dirsize.php) with a custom function which
  utilizes disk_total_space and disk_free_space.

  function usqdirsize($path) {

      $disktotalspace = disk_total_space($path);

      $diskfreespace = disk_free_space($path);

      $diskusage = $disktotalspace - $diskfreespace;

      return $diskusage;

  }

  Question: do we need to calculate the size of a directory by iterating
  its contents? If not happy to commit this patch with a bug report.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1864760/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to