Skip to content

Enhance quota exceeded logging for admins - #37581

Closed
joshtrichards wants to merge 1 commit into
nextcloud:masterfrom
joshtrichards:jr-quota-exceeded-admin-log
Closed

Enhance quota exceeded logging for admins#37581
joshtrichards wants to merge 1 commit into
nextcloud:masterfrom
joshtrichards:jr-quota-exceeded-admin-log

Conversation

@joshtrichards

@joshtrichardsjoshtrichards commented Apr 5, 2023

Copy link
Copy Markdown
Member

Summary

Enhances quota exceeded server-side logging for administrators by adding:

  • target folder owner name (i.e. when shared)
  • indicator of user quota (vs disk space) issue

Context: The existing Insufficient space error logging doesn't indicate the folder owner (which is important since the sharee path is what's logged). In addition, quota issues are addressed differently than, say, disk space issues so administrators benefit from quickly noting the type of Insufficient space issue occurring.

Applies to file/folder operations: uploads, moves, copies

Also:

  • improves - indirectly - the user-facing messaging when uploading (only*)
  • Doesn't include the owner when it's useless (i.e. not shared)

Addresses backend portion of #37519

*Currently working on independent (but related) PRs to unify frontend messaging with same target folder owner inclusion (when applicable)

TODO

  • Review code

Checklist

@joshtrichards

Copy link
Copy Markdown
MemberAuthor

For the record...

Existing log entry for all quota issues:

Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available

New (where owner is applicable):

Quota exceeded in /Project/Videos/lightonflux (owner: sarah), 27136230 required, 343725 available

New (where owner is inapplicable but there's still a quota issue):

Quota exceeded in /QuotaTest, 341471232 required, 301045000 available

@szaimenszaimen added the 3. to review Waiting for reviews label Apr 5, 2023
@szaimenszaimen added this to the Nextcloud 27 milestone Apr 5, 2023
@szaimen
szaimen requested review from a team, ArtificialOwl, blizzz, icewind1991 and nickvergessen and removed request for a teamApril 5, 2023 11:59
@nickvergessen
nickvergessen removed their request for review April 5, 2023 17:25
Comment threadapps/dav/lib/Connector/Sabre/QuotaPlugin.php
This was referenced May 3, 2023
@joshtrichards
joshtrichards requested a review from blizzzMay 9, 2023 16:02
@joshtrichards
joshtrichardsforce-pushed the jr-quota-exceeded-admin-log branch from d536688 to 3ebd206CompareMay 10, 2023 12:22
Comment threadapps/dav/lib/Connector/Sabre/QuotaPlugin.php
@szaimen

Copy link
Copy Markdown
Contributor

/rebase

@szaimen
szaimen enabled auto-merge May 16, 2023 09:07
@nextcloud-command
nextcloud-commandforce-pushed the jr-quota-exceeded-admin-log branch from 3ebd206 to 0111e55CompareMay 16, 2023 09:15
@szaimen

Copy link
Copy Markdown
Contributor

tests failing...

@szaimenszaimen added 2. developing Work in progress and removed 3. to review Waiting for reviews labels May 16, 2023
auto-merge was automatically disabled May 16, 2023 16:20

Head branch was pushed to by a user without write access

@joshtrichards
joshtrichardsforce-pushed the jr-quota-exceeded-admin-log branch from 3d6e63f to 3685013CompareMay 16, 2023 16:21
@szaimenszaimen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 16, 2023
@joshtrichards

joshtrichards commented May 16, 2023

Copy link
Copy Markdown
MemberAuthor

Fixed (at least for me... we'll have to see what the tests say).

In the quota plugin, depending on which before* operation is being called, sometimes checkQuota() gets handed a $path that includes the basename of the URI and other times not so much.

That's current behavior so I'm leaving it be, but I added a check for non-chunked uploads in checkQuota() now just before the getOwner() call in this PR (and then I adjust the $path to exclude the basename). That way we always gets a workable $path for non-chunked uploads (and, more importantly, the same as we'd have gotten if it had been a chunked upload)

The main reason non-chunked uploads triggered this is because the PUT operation never finishes (since the quota is exceeded) so there's really no file to check ownership of - all we have is the intended folder.

All my manual testing was apparently based on doing >10 MB uploads. And the way that chunking-v2 uploads work, the MOVE was giving us what we expected for $path. But <10 MB uploads just do a straight PUT and we receive the full path with the filename intact for the quota check. The integration tests failing all seem to be <10 MB (non-chunked).

@joshtrichards

Copy link
Copy Markdown
MemberAuthor

Incidentally this also fixes a "cosmetic" bug as a side effect versus current master behavior where hitting quota with uploads in the root folder were being mishandled in the logging/notifications:

Before:
NC Files - Quota Full Handling - Screenshot 2023-05-16 130845
After:
NC Files - Quota Full Handling After - Screenshot 2023-05-16 131039

I'd noted this during various bits of testing but hadn't gotten around to checking for prior reports of or root causes for - so that's a nice benefit to this change even if it wasn't the target of (or caused by) this PR. Woohoo!

@szaimenszaimen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 18, 2023
@szaimen
szaimen disabled auto-merge July 18, 2023 21:41
@szaimenszaimen added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 18, 2023
@skjnldsvskjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzzblizzz modified the milestones: Nextcloud 28, Nextcloud 29Nov 23, 2023
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsvskjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv

Copy link
Copy Markdown
Member

What's the status here @joshtrichards :)

@skjnldsvskjnldsv added the stale Ticket or PR with no recent activity label May 30, 2024
This was referenced Jul 30, 2024
This was referenced Aug 5, 2024
@skjnldsvskjnldsv mentioned this pull request Aug 13, 2024
@skjnldsvskjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progressstaleTicket or PR with no recent activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Insufficient Storage Error does not name user (nextcloud.log, android, desktop)

5 participants

@joshtrichards@szaimen@blizzz@skjnldsv@icewind1991