Skip to content

Lock correct paths when moving mount - #17070

Merged
PVince81 merged 2 commits into
masterfrom
lock-movemountbug
Jun 24, 2015
Merged

PVince81 merged 2 commits into
masterfrom
lock-movemountbug

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

This will make tests fail, for example:

1) Test_Files_Sharing_Api::testShareFolderWithAMountPoint
Exception: Tried to unlock a path that was not exclusively locked

/srv/www/htdocs/owncloud/lib/private/lock/memcachelockingprovider.php:100
/srv/www/htdocs/owncloud/lib/private/files/storage/common.php:642
/srv/www/htdocs/owncloud/lib/private/files/view.php:1793
/srv/www/htdocs/owncloud/lib/private/files/view.php:1837
/srv/www/htdocs/owncloud/lib/private/files/view.php:696
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:1213

2) Test_Files_Sharing_Api::testShareStorageMountPoint
OCP\Lock\LockedException: "folder_share_api_test" is locked

/srv/www/htdocs/owncloud/lib/private/files/view.php:1727
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

Caused by
OCP\Lock\LockedException: "files/3b7bfb765164b2cb4ba35323f1f4d5e0" is locked

/srv/www/htdocs/owncloud/lib/private/lock/memcachelockingprovider.php:70
/srv/www/htdocs/owncloud/lib/private/files/storage/common.php:633
/srv/www/htdocs/owncloud/lib/private/files/view.php:1724
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

3) Test_Files_Sharing_Api::testShareNonExisting
OCP\Lock\LockedException: "folder_share_api_test" is locked

/srv/www/htdocs/owncloud/lib/private/files/view.php:1727
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

Caused by
OCP\Lock\LockedException: "files/3b7bfb765164b2cb4ba35323f1f4d5e0" is locked

/srv/www/htdocs/owncloud/lib/private/lock/memcachelockingprovider.php:70
/srv/www/htdocs/owncloud/lib/private/files/storage/common.php:633
/srv/www/htdocs/owncloud/lib/private/files/view.php:1724
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

4) Test_Files_Sharing_Api::testShareNotOwner
OCP\Lock\LockedException: "folder_share_api_test" is locked

/srv/www/htdocs/owncloud/lib/private/files/view.php:1727
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

Caused by
OCP\Lock\LockedException: "files/3b7bfb765164b2cb4ba35323f1f4d5e0" is locked

/srv/www/htdocs/owncloud/lib/private/lock/memcachelockingprovider.php:70
/srv/www/htdocs/owncloud/lib/private/files/storage/common.php:633
/srv/www/htdocs/owncloud/lib/private/files/view.php:1724
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

5) Test_Files_Sharing_Api::testDefaultExpireDate
OCP\Lock\LockedException: "folder_share_api_test" is locked

/srv/www/htdocs/owncloud/lib/private/files/view.php:1727
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

Caused by
OCP\Lock\LockedException: "files/3b7bfb765164b2cb4ba35323f1f4d5e0" is locked

/srv/www/htdocs/owncloud/lib/private/lock/memcachelockingprovider.php:70
/srv/www/htdocs/owncloud/lib/private/files/storage/common.php:633
/srv/www/htdocs/owncloud/lib/private/files/view.php:1724
/srv/www/htdocs/owncloud/lib/private/files/view.php:1813
/srv/www/htdocs/owncloud/lib/private/files/view.php:993
/srv/www/htdocs/owncloud/lib/private/files/view.php:243
/srv/www/htdocs/owncloud/apps/files_sharing/tests/api.php:55

FAILURES!
Tests: 26, Assertions: 129, Errors: 5.

We seem to have a path mismatch issue when moving mount points.
CC @icewind1991 this is the problem I mentioned to you

Might explain the failure in #17030 (comment)

@PVince81 PVince81 mentioned this pull request Jun 22, 2015
2 tasks done
@PVince81

Copy link
Copy Markdown
Contributor Author

Maybe an exception is too "hard" anyway, we might want to log warnings instead, as they might point at programming errors.

@PVince81

Copy link
Copy Markdown
Contributor Author

It looks like this block https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L701 was supposed to be the part that unlocks the moved path.

But for some reason the failure is when unlocking $path1, not $path2.

@PVince81

Copy link
Copy Markdown
Contributor Author

Remember that a lock is based on storage id + internal path.

It looks like after moving the mount, the storage id changes, so it doesn't match the same lock.
So when moving "/files/somemount" to "/files/sub/somemount", at first the lock is on "/files/somemount" with the storage id of "somemount". But then after moving it in the subdirect, "/files/somemount" doesn't exist any more, but would be on the storage id of the root anyway.

@PVince81 PVince81 added this to the 8.1-current milestone Jun 22, 2015
@PVince81 PVince81 self-assigned this Jun 22, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

Something to think about when moving shared mount points "/files/sharex" to "/files/sub/sharex":

Do we need to lock 3 paths ?

  • recipient's source path: "home::recipient::/files/sharex" with LOCK_EXCLUSIVE
  • recipient's target path: "home::recipient::/files/sub/sharex" with LOCK_EXCLUSIVE
  • owner's actual path: "home::owner::/files/outgoingshares/sharex" with LOCK_EXCLUSIVE

The current implementation locks $path1 as "home::owner::/files/outgoingshares/sharex" (due to the internal path resolution) and "home::recipient::/files/sub/sharex", both with LOCK_EXCLUSIVE

We might want to put the locks only on the recipient's paths.

Do we really need to lock the owner's path when the recipient is moving mounts ? What kind of concurrency could happen ?

@PVince81

Copy link
Copy Markdown
Contributor Author

I think we probably don't need to lock the owner's path at all when moving a mount, as it neither affects the files inside or it nor the parent folders in the owner's tree.

So we need to change this code to always lock:

  • recipient's source path: "home::recipient::/files/sharex" with LOCK_EXCLUSIVE
  • recipient's target path: "home::recipient::/files/sub/sharex" with LOCK_EXCLUSIVE
    (and implicitly sets a LOCK_SHARED on the parent folders, as usual)

@PVince81

Copy link
Copy Markdown
Contributor Author

I think in most cases it probably seldom makes sense to call lockPath() with EXCLUSIVE on the root of a storage. So one possibility would be to modify View::lockPath() to detect if internal path is an empty string. If yes, it will lock the other storage instead, the one where the storage was mounted. This instead of locking the root of the other storage.

@PVince81

Copy link
Copy Markdown
Contributor Author

Looks like it's not a good idea to throw exceptions when unlocking non-locked paths, because: sometimes two shutdown handlers might run in parallel, the first one being "release_all" but the other one being a stream wrapper closing a file for which the lock was already removed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add an else for other types?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because aquireLock without any other value then self::LOCK_SHARED will create a exclusive lock

@PVince81
PVince81 force-pushed the lock-movemountbug branch from 4ca3cb3 to 9259900 Compare June 22, 2015 14:41
@PVince81 PVince81 changed the title [WIP] Throw exception when unlocking non-locked path Lock correct paths when moving mount Jun 22, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

To test:

  1. Enable locking
  2. Share a folder with "user2".
  3. Login as "user2"
  4. Move the folder as recipient into a subdir (web UI and webdav).

This already worked before, but the paths used for locking were wrong, so https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L696 did not unlock anything. (can be observed by making the MemcacheLockingWrapper throw exceptions when unlocking a non-locked path, something we don't want to have permanently though)

@icewind1991 @nickvergessen please review

@PVince81

Copy link
Copy Markdown
Contributor Author

Explanation for the decision here: #17070 (comment) and the comment after that.

@PVince81

Copy link
Copy Markdown
Contributor Author

@nickvergessen I removed throwing exceptions on releaseLock, because it might fail in some legitimate cases like shutdown handlers.

@PVince81

Copy link
Copy Markdown
Contributor Author

This PR blocks #17030

@PVince81

Copy link
Copy Markdown
Contributor Author

@nickvergessen @icewind1991 there is a tiny tiny chance that this might fix #17029 too because this is also about the rename/move lock paths.

I'll also try and run smashbox later.

@nickvergessen

Copy link
Copy Markdown
Contributor

I think we probably don't need to lock the owner's path at all when moving a mount, as it neither affects the files inside or it nor the parent folders in the owner's tree.

Well the problem is we need to update the path column for all entries. So when a file is renamed in the mean time, crap might happen, no?

@icewind1991

Copy link
Copy Markdown
Contributor

👍 looks good

@PVince81

Copy link
Copy Markdown
Contributor Author

When moving a shared mount we only need to update one entry in the oc_share table, and it's the one from the recipient.

Locking the root of any storage doesn't have any effect because no one can rename the parent of it since it has no parent. The point of having a shared lock on a folder is to avoid someone else either touching that folder or any parent exclusively (move/delete) which can never happen in the case of a root folder.

@PVince81

Copy link
Copy Markdown
Contributor Author
  • double check what happens for file shares, might require exclusive lock still

@nickvergessen

Copy link
Copy Markdown
Contributor

Locking the root of any storage doesn't have any effect because no one can rename the parent of it since it has no parent. The point of having a shared lock on a folder is to avoid someone else either touching that folder or any parent exclusively (move/delete) which can never happen in the case of a root folder.

Thanks for the explanation

@PVince81

Copy link
Copy Markdown
Contributor Author

In the case of shared files, we might still need an exclusive lock when the file is being overwritten. Internally the shared file is the shared storage's root.

@PVince81

Copy link
Copy Markdown
Contributor Author

The only one situation I think where the shared storage root must be locked is for file shares, but not for all file actions.

Move, rename or unshare from self as recipient has no effect on the contents, so it doesn't make sense to lock it for those. (if we did, it means that no other recipient would be allowed to edit the file during these operations)

However read would require a shared lock and write an exclusive one.
Maybe these two locks should be acquired additionally inside the respective action methods.

@PVince81

Copy link
Copy Markdown
Contributor Author

Hmmmm, how about adding a flag "$alsoLockMountRoots = false" to the view's locking methods ?
This way only the file operations would set it to true to make sure the mount point root is locked too.

@ghost

ghost commented Jun 22, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

@PVince81

Copy link
Copy Markdown
Contributor Author

If I don't find any better idea until tomorrow, I'll just go ahead with the extra argument.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

I need a DB expert...

@dragotin 🐱

@PVince81

Copy link
Copy Markdown
Contributor Author

If while process A uploads the file I do the UPDATE statement with the CLI MySQL client, it goes through. So why wouldn't the one from process B ? Maybe process B is somehow stuck in a weird transaction.

@PVince81

Copy link
Copy Markdown
Contributor Author

I'll check the other selects on that table and check for unclosed cursors

@PVince81

Copy link
Copy Markdown
Contributor Author

No luck adding closeCursor() to queries related to oc_share... 😦

@PVince81

Copy link
Copy Markdown
Contributor Author

Next up: enabling debugging on the MySQL side to find out about implicit rollbacks

@PVince81

Copy link
Copy Markdown
Contributor Author

And here we go:

150624 13:24:52     5 Connect   owncloud@localhost as anonymous on owncloud
            5 Query SET NAMES utf8
            5 Query SET SESSION AUTOCOMMIT=1
            5 Query SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
            5 Query SELECT `appid`, `configvalue` FROM `oc_appconfig` WHERE `configkey` = 'installed_version'
            5 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'core'
            5 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'enabled'
            5 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'types'
            5 Query SELECT `id` FROM `oc_jobs` WHERE `class` = 'OCA\\Files_sharing\\Lib\\DeleteOrphanedSharesJob' AND `argument` = 'null'
            5 Query SELECT `uid`, `password` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('usera')
            5 Query SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'usera'
            5 Query SELECT `configvalue` FROM `oc_preferences` WHERE `userid` = 'usera' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            5 Query UPDATE `oc_preferences` SET `configvalue` = '1435145092' WHERE `userid` = 'usera' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            5 Query SELECT `uid`, `displayname` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('usera')
            5 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'local::/srv/www/htdocs/owncloud/data/usera/'
            5 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files_sharing'
            5 Query SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
                FROM `oc_share_external`
                WHERE `user` = 'usera' AND `accepted` = '1'
            5 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files'
            5 Query SELECT `gid` FROM `oc_group_user` WHERE `uid` = 'usera'
            5 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid`  AND `file_target` IS NOT NULL INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'usera') ) AND `uid_owner` != 'usera' ORDER BY `oc_share`.`id` ASC
            5 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'home::usera'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            5 Query SELECT `id`, `mimetype` FROM `oc_mimetypes`
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query UPDATE `oc_filecache` SET `etag` = '558a938452d72', `mtime` = '1435145016', `storage_mtime`='1435145016' WHERE (`etag` <> '558a938452d72' OR `mtime` <> '1435145016' OR `storage_mtime` <> '1435145016' ) AND `fileid` = '16'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                           `storage_mtime`, `encrypted`, `etag`, `permissions`
                    FROM `oc_filecache` WHERE `parent` = '16' ORDER BY `name` ASC
            5 Query START TRANSACTION
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '919fc88b1eb1f74a694c5ad883f33ec4'
            5 Query COMMIT
            5 Query UPDATE `oc_filecache` SET `size`='14' WHERE (`size` <> '14' ) AND `fileid` = '16'
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                           `storage_mtime`, `encrypted`, `etag`, `permissions`
                    FROM `oc_filecache` WHERE `parent` = '16' ORDER BY `name` ASC
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 FROM `oc_filecache` WHERE `parent` = '16' AND `storage` = '3'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            5 Query SELECT SUM(`size`) AS f1 FROM `oc_filecache` WHERE `parent` = '10' AND `storage` = '3' AND `size` >= 0
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a938456069' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a938456069' ) AND `fileid` = '10'
            5 Query SELECT * FROM `oc_share` WHERE `file_source` = '10'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '842801b5a42ae428d8bf32b252a14171'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a938456cc6' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a938456cc6' ) AND `fileid` = NULL
            5 Query SELECT * FROM `oc_share` WHERE `file_source` = NULL
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = 'a13d55d6263a34d6d737c56f6477e694'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a9384571d1' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a9384571d1' ) AND `fileid` = NULL
            5 Query SELECT * FROM `oc_share` WHERE `file_source` = NULL
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '919fc88b1eb1f74a694c5ad883f33ec4'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '919fc88b1eb1f74a694c5ad883f33ec4'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '9692aae50022f45f1098646939b287b1'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '919fc88b1eb1f74a694c5ad883f33ec4'
            5 Query SELECT `id` FROM `oc_jobs` WHERE `class` = 'OC\\Command\\CommandJob' AND `argument` = '\"O:33:\\\"OCA\\\\Files_Versions\\\\Command\\\\Expire\\\":4:{s:43:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000fileName\\\";s:21:\\\"\\/foldershare\\/test.txt\\\";s:47:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000versionsSize\\\";i:616;s:46:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000neededSpace\\\";d:35;s:39:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000user\\\";s:5:\\\"usera\\\";}\"'
            5 Query INSERT INTO `oc_jobs`(`class`, `argument`, `last_run`) VALUES('OC\\Command\\CommandJob', '\"O:33:\\\"OCA\\\\Files_Versions\\\\Command\\\\Expire\\\":4:{s:43:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000fileName\\\";s:21:\\\"\\/foldershare\\/test.txt\\\";s:47:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000versionsSize\\\";i:616;s:46:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000neededSpace\\\";d:35;s:39:\\\"\\u0000OCA\\\\Files_Versions\\\\Command\\\\Expire\\u0000user\\\";s:5:\\\"usera\\\";}\"', 0)
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '96509ffc3710bd3bee0393bad75632d7'
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '5c1c1131e71278cd7a0811217e6bcff0'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '96509ffc3710bd3bee0393bad75632d7'
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '96509ffc3710bd3bee0393bad75632d7'
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '5c1c1131e71278cd7a0811217e6bcff0'
            5 Query INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`path_hash`,`path`,`name`,`storage`) SELECT '7','8','1435145092','14','08d237b2857fb2deb462f2a829f1620d','1435145092','27','55','96509ffc3710bd3bee0393bad75632d7','files_versions/foldershare/test.txt.v1435144986','test.txt.v1435144986','3' FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '96509ffc3710bd3bee0393bad75632d7' HAVING COUNT(*) = 0
            5 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '5c1c1131e71278cd7a0811217e6bcff0'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `storage_mtime`='1435145092' WHERE (`mtime` <> '1435145092' OR `storage_mtime` <> '1435145092' ) AND `fileid` = '55'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '5c1c1131e71278cd7a0811217e6bcff0'
            5 Query SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 FROM `oc_filecache` WHERE `parent` = '55' AND `storage` = '3'
            5 Query UPDATE `oc_filecache` SET `size`='588' WHERE (`size` <> '588' ) AND `fileid` = '55'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '9692aae50022f45f1098646939b287b1'
            5 Query SELECT SUM(`size`) AS f1 FROM `oc_filecache` WHERE `parent` = '27' AND `storage` = '3' AND `size` >= 0
            5 Query UPDATE `oc_filecache` SET `size`='630' WHERE (`size` <> '630' ) AND `fileid` = '27'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = 'd41d8cd98f00b204e9800998ecf8427e'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a93845f801' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a93845f801' ) AND `fileid` = '8'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '9692aae50022f45f1098646939b287b1'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a938461d9b' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a938461d9b' ) AND `fileid` = '27'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '5c1c1131e71278cd7a0811217e6bcff0'
            5 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `etag`='558a93846467d' WHERE (`mtime` <> '1435145092' OR `etag` <> '558a93846467d' ) AND `fileid` = '55'
            5 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '96509ffc3710bd3bee0393bad75632d7'
150624 13:24:53     6 Connect   owncloud@localhost as anonymous on owncloud
            6 Query SET NAMES utf8
            6 Query SET SESSION AUTOCOMMIT=1
            6 Query SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
            6 Query SELECT `appid`, `configvalue` FROM `oc_appconfig` WHERE `configkey` = 'installed_version'
            6 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'core'
            6 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'enabled'
            6 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'types'
            6 Query SELECT `id` FROM `oc_jobs` WHERE `class` = 'OCA\\Files_sharing\\Lib\\DeleteOrphanedSharesJob' AND `argument` = 'null'
            6 Query SELECT `uid`, `password` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('userb')
            6 Query SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'userb'
            6 Query SELECT `configvalue` FROM `oc_preferences` WHERE `userid` = 'userb' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            6 Query UPDATE `oc_preferences` SET `configvalue` = '1435145093' WHERE `userid` = 'userb' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            6 Query SELECT `uid`, `displayname` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('userb')
            6 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'local::/srv/www/htdocs/owncloud/data/userb/'
            6 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files_sharing'
            6 Query SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
                FROM `oc_share_external`
                WHERE `user` = 'userb' AND `accepted` = '1'
            6 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files'
            6 Query SELECT `gid` FROM `oc_group_user` WHERE `uid` = 'userb'
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid`  AND `file_target` IS NOT NULL INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' ORDER BY `oc_share`.`id` ASC
            6 Query SELECT `uid`, `displayname` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('usera')
            6 Query SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'usera'
            6 Query SELECT `configvalue` FROM `oc_preferences` WHERE `userid` = 'userb' AND `appid` = 'files_sharing' AND `configkey` = 'last_propagate'
            6 Query UPDATE `oc_preferences` SET `configvalue` = '1435145093.877' WHERE `userid` = 'userb' AND `appid` = 'files_sharing' AND `configkey` = 'last_propagate'
            6 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'home::userb'
            6 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            6 Query SELECT `id`, `mimetype` FROM `oc_mimetypes`
            6 Query UPDATE `oc_filecache` SET `mtime` = '1435145093', `etag`='558a9385d7a48' WHERE (`mtime` <> '1435145093' OR `etag` <> '558a9385d7a48' ) AND `fileid` = '20'
            6 Query SELECT * FROM `oc_share` WHERE `file_source` = '20'
            6 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '7aaf2f6cb632eef9e282a78d919736c3'
            6 Query UPDATE `oc_filecache` SET `mtime` = '1435145093', `etag`='558a9385d8637' WHERE (`mtime` <> '1435145093' OR `etag` <> '558a9385d8637' ) AND `fileid` = '30'
            6 Query SELECT * FROM `oc_share` WHERE `file_source` = '30'
            6 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'local::/srv/www/htdocs/owncloud/data/usera/'
            6 Query SELECT `gid` FROM `oc_group_user` WHERE `uid` = 'usera'
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid`  AND `file_target` IS NOT NULL INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'usera') ) AND `uid_owner` != 'usera' ORDER BY `oc_share`.`id` ASC
            6 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            6 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            6 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'home::usera'
            6 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/fileshare.txt' ORDER BY `oc_share`.`id` DESC LIMIT 3
            6 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            6 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = 'ec3683e4b7187d94032783a9b1231c50'
            6 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/fileshare.txt' ORDER BY `oc_share`.`id` DESC LIMIT 3
            6 Query SELECT * FROM `oc_properties` WHERE `userid` = 'userb' AND `propertypath` = '/' AND `propertyname` in ('{http://apache.org/dav/props/}executable', '{DAV:}checked-in', '{DAV:}checked-out')
            6 Quit  
            7 Connect   owncloud@localhost as anonymous on owncloud
            7 Query SET NAMES utf8
            7 Query SET SESSION AUTOCOMMIT=1
            7 Query SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
            7 Query SELECT `appid`, `configvalue` FROM `oc_appconfig` WHERE `configkey` = 'installed_version'
            7 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'core'
            7 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'enabled'
            7 Query SELECT `configvalue`, `appid` FROM `oc_appconfig` WHERE `configkey` = 'types'
            7 Query SELECT `id` FROM `oc_jobs` WHERE `class` = 'OCA\\Files_sharing\\Lib\\DeleteOrphanedSharesJob' AND `argument` = 'null'
            7 Query SELECT `uid`, `password` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('userb')
150624 13:24:54     7 Query SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'userb'
            7 Query SELECT `configvalue` FROM `oc_preferences` WHERE `userid` = 'userb' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            7 Query UPDATE `oc_preferences` SET `configvalue` = '1435145094' WHERE `userid` = 'userb' AND `appid` = 'login' AND `configkey` = 'lastLogin'
            7 Query SELECT `uid`, `displayname` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('userb')
            7 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'local::/srv/www/htdocs/owncloud/data/userb/'
            7 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files_sharing'
            7 Query SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
                FROM `oc_share_external`
                WHERE `user` = 'userb' AND `accepted` = '1'
            7 Query SELECT `configvalue`, `configkey` FROM `oc_appconfig` WHERE `appid` = 'files'
            7 Query SELECT `gid` FROM `oc_group_user` WHERE `uid` = 'userb'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid`  AND `file_target` IS NOT NULL INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' ORDER BY `oc_share`.`id` ASC
            7 Query SELECT `uid`, `displayname` FROM `oc_users` WHERE LOWER(`uid`) = LOWER('usera')
            7 Query SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'usera'
            7 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'local::/srv/www/htdocs/owncloud/data/usera/'
            7 Query SELECT `gid` FROM `oc_group_user` WHERE `uid` = 'usera'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid`  AND `file_target` IS NOT NULL INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'usera') ) AND `uid_owner` != 'usera' ORDER BY `oc_share`.`id` ASC
            7 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'home::userb'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            7 Query SELECT `id`, `mimetype` FROM `oc_mimetypes`
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `numeric_id` FROM `oc_storages` WHERE `id` = 'home::usera'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/fileshare.txt' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = 'ec3683e4b7187d94032783a9b1231c50'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/fileshare.txt' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = 'ade12aa9a2fcb78d16c649c813e122c6'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid` FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query UPDATE `oc_filecache` SET `mtime` = '1435145092', `size` = '-1', `etag` = '558a938618773', `storage_mtime`='1435145092' WHERE (`mtime` <> '1435145092' OR `size` <> '-1' OR `etag` <> '558a938618773' OR `storage_mtime` <> '1435145092' ) AND `fileid` = '16'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                           `storage_mtime`, `encrypted`, `etag`, `permissions`
                    FROM `oc_filecache` WHERE `parent` = '16' ORDER BY `name` ASC
            7 Query START TRANSACTION
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/sub/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query Update `oc_share`
                        SET `file_target` = '/re'
                        WHERE `id` = '1'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '45b963397aa40d4a0063e0d85e4fe7a1'
            7 Query UPDATE `oc_filecache` SET `mtime` = '1435145094', `etag`='558a93861c036' WHERE (`mtime` <> '1435145094' OR `etag` <> '558a93861c036' ) AND `fileid` = '20'
            7 Query SELECT * FROM `oc_share` WHERE `file_source` = '20'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '4' AND `path_hash` = '7aaf2f6cb632eef9e282a78d919736c3'
            7 Query UPDATE `oc_filecache` SET `mtime` = '1435145094', `etag`='558a93861c4d8' WHERE (`mtime` <> '1435145094' OR `etag` <> '558a93861c4d8' ) AND `fileid` = '30'
            7 Query SELECT * FROM `oc_share` WHERE `file_source` = '30'
            7 Query UPDATE `oc_properties` SET `propertypath` = '/re' WHERE `userid` = 'userb' AND `propertypath` = '/sub/re'
            7 Query DELETE FROM `oc_properties` WHERE `userid` = 'userb' AND `propertypath` = '/sub/re'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query SELECT `id` FROM `oc_storages` WHERE `numeric_id` = '3'
            7 Query SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
                       `storage_mtime`, `encrypted`, `etag`, `permissions`
                FROM `oc_filecache` WHERE `storage` = '3' AND `path_hash` = '85f0a6e28541f54994d2b5a5e7e3b1be'
            7 Query SELECT `oc_share`.`id`, `item_type`, `item_source`, `item_target`,`oc_share`.`parent`, `share_type`, `share_with`, `uid_owner`,`file_source`, `path`, `file_target`, `oc_share`.`permissions`,`stime`, `expiration`, `token`, `storage`, `mail_send`,`oc_storages`.`id` AS `storage_id` FROM `oc_share` INNER JOIN `oc_filecache` ON `file_source` = `oc_filecache`.`fileid` INNER JOIN `oc_storages` ON `numeric_id` = `oc_filecache`.`storage`  AND ((`share_type` in ('0', '2') AND `share_with` = 'userb') ) AND `uid_owner` != 'userb' AND `file_target` = '/re' ORDER BY `oc_share`.`id` DESC LIMIT 3
            7 Query ROLLBACK
            7 Quit  

5 Query must be the PUT upload from process A.
6 is the PROPFIND from cadaver before MOVE from process B
7 is the MOVE from process B

For some reason there's a "ROLLBACK" at the end!

@PVince81

Copy link
Copy Markdown
Contributor Author

I debugged up to the end of the request, including destructors and shutdown handlers. There is no exception happening anywhere.

I tried removing the "INNER JOIN" in share.php and adding close cursor in many places.

None of this helped so far.

@PVince81

Copy link
Copy Markdown
Contributor Author

Ok, after a second look at the SQL logs, I see there is a "START TRANSACTION" a few lines before the broken update. It means something starts a transaction but doesn't commit at the end.

I suspect there might be a swallowed LockedException that might make another piece of code bypass the commit().

I'll check the places where beginTransaction() is called.

@PVince81

Copy link
Copy Markdown
Contributor Author

Ok got it, it's indeed the scanner. A LockedException occurs and it makes it jump past the "commit()" and be caught later...

@PVince81
PVince81 force-pushed the lock-movemountbug branch from b6d0690 to 8859004 Compare June 24, 2015 13:42
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@PVince81

Copy link
Copy Markdown
Contributor Author

And here is the fix: 8859004

I hope I'll now be able to finish testing this PR.

@PVince81

Copy link
Copy Markdown
Contributor Author
  • BUG: B unshares "fileshare.txt" from self (internally it's a delete-type operation), A can still overwrite => currently getting 423 locked. Here only the mount point should be locked. Not sure where that lock is set because removeMount doesn't have it (see removeMount should lock #17144)

@PVince81

Copy link
Copy Markdown
Contributor Author

=> totally unrelated to this PR or touched code paths.
Let's follow up with this in #17144

@PVince81

Copy link
Copy Markdown
Contributor Author

also this happens when using SFTP + share, not on regular root.

@PVince81

Copy link
Copy Markdown
Contributor Author

This PR is ready to review @icewind1991 @nickvergessen
(hoping for Jenkins to pass again)

@ghost

ghost commented Jun 24, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

@icewind1991

Copy link
Copy Markdown
Contributor

👍 looks good

@PVince81

Copy link
Copy Markdown
Contributor Author

@nickvergessen second review ?

@nickvergessen

Copy link
Copy Markdown
Contributor

Yeah, let me run SB first just to make sure nothing breaks ;)

@PVince81

Copy link
Copy Markdown
Contributor Author

Okay, so expecting a merge in the next 3 hours then ? 😉
Thanks

@nickvergessen

Copy link
Copy Markdown
Contributor
OC Test Result
test_reshareDir -a ✅
test_shareDir -a ✅
test_shareFile -a ✅
test_shareGroup -a ✅
test_sharePermissions -a ✖️ (no new fails)
test_uploadFiles -a ✅
Cern Test Result
test_basicSync -a ✅
test_concurrentDirMove -a ✖️ (no new fails)
test_concurrentDirRemove -a ✅
test_concurrentOverwriteFile -a ✅

@nickvergessen

Copy link
Copy Markdown
Contributor

👍 thanks for tackling this down @PVince81 now grab some 🍺

@PVince81

Copy link
Copy Markdown
Contributor Author

Thanks a lot! Merging.

PVince81 pushed a commit that referenced this pull request Jun 24, 2015
Lock correct paths when moving mount
@PVince81
PVince81 merged commit 58439c3 into master Jun 24, 2015
@PVince81
PVince81 deleted the lock-movemountbug branch June 24, 2015 16:37
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 11, 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.

5 participants