Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

existing files not synced in a shared workspace #913

Closed
plexorama opened this issue May 15, 2015 · 1 comment
Closed

existing files not synced in a shared workspace #913

plexorama opened this issue May 15, 2015 · 1 comment

Comments

@plexorama
Copy link

Files already existing in a shared workspace are not synced. I was able to pinpoint the cause of the problem. It seems that ChangesTracker::switchAction() in meta.syncable/class.ChangesTracker.php does not track changes done by the owner of the repository before sharing the directory as workspace.

You may replicate the issue as follows:

  1. Create a new folder in "My files" and upload some files to it.
  2. Go to your "Address Book" and create a new user
  3. Share the new folder as a workspace with the recenlty created user
  4. Create a sync job in your pydio-sync client using the new user's credentials

The pydio-sync-ui shows a 0 bytes DATA SIZE and only newly uploaded files will be synced after that point. Any existing files won't be sync'd.

The changes are stored in ajxp_changes table, however the query on line 251 in ChangesTracker::switchActions() only takes changes into account when a repository_identifier uuid is stored in ajxp_repo table and it matches with ajxp_changes repository_identifier.

Check for yourself:

SELECT
seq , ajxp_changes.repository_identifier , ajxp_changes.node_id , 
type , source ,  target , ajxp_index.bytesize, ajxp_index.md5, 
ajxp_index.mtime, ajxp_index.node_path
FROM ajxp_changes
LEFT JOIN ajxp_index
    ON ajxp_changes.node_id = ajxp_index.node_id
WHERE ajxp_changes.repository_identifier = '<REPO_ID>' AND seq > 0
ORDER BY ajxp_changes.node_id, seq ASC

Replace REPO_ID with the correct UUID of the shared workspace.

I guess a quick fix would be to add a repository_identifier for every created directory, such that changes are correctly tracked.

@cdujeu
Copy link
Member

cdujeu commented Jun 16, 2015

Hi Plexorama,
It's not really going like that. The problem is indeed that the shared workspace is not indexed first, but we have a mechanism to detect that and make sure this indexation is triggered the first time we ask for the changes.
But I recently noticed that this was not working in some case. See

if($index == "meta.syncable" && $data["REPO_SYNCABLE"] === true ){
, try replacing this line with
if($index == "meta.syncable" && (!isSet($data["REPO_SYNCABLE"]) || $data["REPO_SYNCABLE"] === true )){, this should work better.
Thanks for testing and reporting.
-c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants