Skip to content

id of deleted project will be kept in workspace.json #1418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
boferri opened this issue Jan 5, 2018 · 4 comments · Fixed by #4796
Closed

id of deleted project will be kept in workspace.json #1418

boferri opened this issue Jan 5, 2018 · 4 comments · Fixed by #4796
Assignees
Labels
persistence Issues about the way user data is saved on disk Type: Bug Issues related to software defects or unexpected behavior, which require resolution.
Milestone

Comments

@boferri
Copy link

boferri commented Jan 5, 2018

I have a project that makes use of another project (as mapping table). After the processing (i.e. application of the mapping rules (JSON history) + exporting the result), I'm deleting both projects. Only the id of the main project will be kept in workspace.json. The auxiliary project (with the mapping table) disappears as expected. When I restart OpenRefine, it tries to recover the project whose id still has been left in the workspace.json. When I try to reimport both projects and do the processing afterwards, then the mapping table won't be applied. So I guess it has something to do with the incomplete removal (and the unsuccessful recovery after OpenRefine restart) of the main project.
My current workaround is that I'll give the main project each time a new name at import.

tested with OpenRefine 2.7 and 2.8

@jackyq2015
Copy link
Contributor

are you sure the project were removed? The project only will try to recovery if the project folder is there.

@boferri
Copy link
Author

boferri commented Jan 8, 2018

The project has been created after applying the mappings (JSON history) to the main project. After removal of the main project the project folder disappeared and the only things that has been left was the id of the main project in the workspace.json. Hence, the existence of this id causes (from my understanding) the creation of the (empty) project folder (after OpenRefine restart).

@thadguidry thadguidry added Type: Bug Issues related to software defects or unexpected behavior, which require resolution. Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators labels Jul 3, 2018
@wetneb wetneb added the persistence Issues about the way user data is saved on disk label Dec 22, 2019
@tfmorris tfmorris removed the Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators label Jun 22, 2020
@tfmorris
Copy link
Member

Refine deletes the project directory and immediately saves the workspace:

public void deleteProject(long projectID) {
synchronized (this) {
removeProject(projectID);
File dir = getProjectDir(projectID);
if (dir.exists()) {
deleteDir(dir);
}
}
saveWorkspace();
}

so it's difficult to see how this could happen unless it's unable to delete the project data directory for some reason (external tool with a file open it?).

@Zazi Are you using the OpenRefine web interface? Can you provide the steps to reproduce this?

@WaltonG
Copy link
Member

WaltonG commented Apr 21, 2022

Steps to reproduce have been stated in a comment of a related issue #3719

@WaltonG WaltonG self-assigned this Apr 21, 2022
wetneb pushed a commit that referenced this issue May 30, 2022
@wetneb wetneb added this to the 3.6 milestone May 30, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
antoine2711 pushed a commit that referenced this issue Jun 21, 2022
tfmorris added a commit to tfmorris/OpenRefine that referenced this issue Sep 13, 2023
tfmorris added a commit to tfmorris/OpenRefine that referenced this issue Sep 13, 2023
wetneb pushed a commit that referenced this issue Sep 25, 2023
* Restore previous constructor behavior

Use modified time if we're given one.

* Enhance test to cover initial read case

It wasn't testing if an unnecessary project
write occurs when projects are read, but
not written

* Make sure lastSave timestamp is initialized on load - fixes #3805

* Fix test for workspace save on project remove from PR #4796

* Save workspace when projects removed. Fixes #1418

* Refactor to clean up workspace save

- only write temp file if needed rather than writing,
  then deleting if unneeded
- check and log errors on file create/delete/rename
- use try-with-resources to avoid resource leaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
persistence Issues about the way user data is saved on disk Type: Bug Issues related to software defects or unexpected behavior, which require resolution.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants