Skip to content
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

Distinguish shared indexes with different index versions #564

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Nov 28, 2022

Signed-off-by: Jinbo Wang jinbwan@microsoft.com

This is an enhancement to previous commit "shared JDT Index folder among different workspaces". The problem with shared indexes is that the index schema can evolve over time, and reusing outdated indexes from shared folders does not work. Currently, unless you read the original contents of the *.index file, it is not clear what index version is being used in the shared folder. To make it more intuitive, one suggestion is to force the shared folder structure to be organized as <base_path>/<index_version>/*.index, then you have to enable the system property in the format like -Djdt.core.sharedIndexLocation=<base_path>.

This is also similar to a shared m2 dir, and allows multiple versions of indexes to coexist.

@testforstephen
Copy link
Contributor Author

@rgrunber WDYT?

@rgrunber
Copy link
Contributor

rgrunber commented Nov 28, 2022

I guess my only concern is about maintaining the older index files. Is it that expensive to simply regenerate the index files every time the version is updated ? The last index update was done for Photon (4.8) so it happens pretty rarely. Or is the goal to prevent the shared index folder from growing too large ? If so, maybe clients should institute some kind of mechanism to remove old entries ?

Looking at updates to SIGNATURE :

1.130 -> 1.131 at bf6a400 (Feb 2018)
1.129 -> 1.130 at a9993d1 (Jan 2017)
1.128 -> 1.129 at 1b4ae3c (Dec 2015)

@testforstephen
Copy link
Contributor Author

testforstephen commented Nov 29, 2022

We don't update the index version too often, I'm not worried about the storage of keeping multiple versions of index files in the cache.

The goal is to make multiple index versions co-exist in the same folder. Because we use the checksum of the library file path to name the index files, different index versions will use the same index name for the same library, multiple versions are impossible to co-exist in same folder. If the JDT workspace detects a mismatch between the existing index file versions, the index manager will delete the old index and regenerate a new one here. Imagine opening different versions of JDT (e.g. nightly build and stable version) with the same index folder, which would cause each JDT instance to regenerate the same index file back and forth.

I'm seeing a recent PR #534 is updating the index version, that means this version mismatch could happen in near future.

@rgrunber rgrunber self-requested a review November 30, 2022 18:11
@rgrunber rgrunber added this to the 4.27 M1 milestone Nov 30, 2022
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

The change works for me. As JDT-LS was the main motivation for this feature, I think we should be fine to break the previous behaviour (all lookups at the root of the folder). Future users of this feature will just have to be aware of the index version in order to get the lookup to work correctly.

@rgrunber rgrunber merged commit e7f6aea into eclipse-jdt:master Dec 9, 2022
@testforstephen testforstephen deleted the jinbo_sharedindex branch December 10, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants