Skip to content

Properly handle deleted users in UserMountCache#27028

Merged
PVince81 merged 1 commit into
masterfrom
usermountcache-deletedusers
Jan 30, 2017
Merged

Properly handle deleted users in UserMountCache#27028
PVince81 merged 1 commit into
masterfrom
usermountcache-deletedusers

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

Description

When encountering entries from a deleted user, discard such entries.

Related Issue

Fixes #27012

Motivation and Context

How Has This Been Tested?

#27012 (comment)

Comments can be posted and no exceptions after the fix.
Also, the bogus entries with "unexist" are removed from oc_mounts.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Please review @butonic @jvillafanez @IljaN @VicDeo

When encountering entries from a deleted user, discard such entries.
@mention-bot

Copy link
Copy Markdown

@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DeepDiver1975 to be a potential reviewer.

@PVince81

Copy link
Copy Markdown
Contributor Author

Testes passed on Jenkins

private function dbRowToMountInfo(array $row) {
$user = $this->userManager->get($row['user_id']);
if ($user === null) {
// user does not exist any more, delete all mounts of that user directly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels misplaced. I'm talking strictly about the code, not the behaviour. I'd expect the function to convert the row, not to delete things.

Maybe adding a private function deleteSharesOfMissingUser or similar, and move it to the getMountsForUser function just before starting the conversion might look better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug in question was from yet another code path using dbRowToMountInfo.

Another alternative would be to use a repair step I guess.

@jvillafanez jvillafanez Jan 27, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like to use a repair step for this because this could happen often and we can't keep on repairing over and over.

I don't have better alternatives, so let's say "this is private stuff" 😄

@jvillafanez

Copy link
Copy Markdown
Member

👍

@PVince81

Copy link
Copy Markdown
Contributor Author

Maybe some day we'll use foreign keys and it will all be the job of cascading delete...

@PVince81

Copy link
Copy Markdown
Contributor Author

Tests pass on Jenkins, results unpublished.

@PVince81
PVince81 merged commit f1e31f0 into master Jan 30, 2017
@PVince81
PVince81 deleted the usermountcache-deletedusers branch January 30, 2017 08:44
@PVince81

Copy link
Copy Markdown
Contributor Author

I'll take care of the backports after the freeze.

@PVince81

Copy link
Copy Markdown
Contributor Author

stable9.1: #27488
stable9: #27489

@lock

lock Bot commented Aug 3, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error while posting comment in web view

3 participants