1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Bug 510054 - Unrecoverable index file corruption

Change-Id: Iba386baf2c62f10044c4ffc1f399823a94aacf84
This commit is contained in:
Sergey Prigogin 2017-01-06 13:46:38 -08:00
parent fe3a787663
commit 7bfdf9a591
2 changed files with 10 additions and 5 deletions

View file

@ -425,11 +425,14 @@ public class PDOM extends PlatformObject implements IPDOM {
db = new Database(fPath, cache, getDefaultVersion(), isPermanentlyReadOnly()); db = new Database(fPath, cache, getDefaultVersion(), isPermanentlyReadOnly());
db.setLocked(lockDB); db.setLocked(lockDB);
try {
if (isSupportedVersion()) { if (isSupportedVersion()) {
readLinkages(); readLinkages();
} }
} finally {
db.setLocked(lockCount != 0); db.setLocked(lockCount != 0);
} }
}
public IIndexLocationConverter getLocationConverter() { public IIndexLocationConverter getLocationConverter() {
return locationConverter; return locationConverter;

View file

@ -384,8 +384,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
WritablePDOM pdom; WritablePDOM pdom;
try { try {
pdom= new WritablePDOM(dbFile, new PDOMProjectIndexLocationConverter(project), getLinkageFactories()); pdom= new WritablePDOM(dbFile, new PDOMProjectIndexLocationConverter(project), getLinkageFactories());
} catch (CoreException e) { } catch (CoreException | RuntimeException e) {
CCorePlugin.log("Failed to open C/C++ index " + dbFile.getAbsolutePath() //$NON-NLS-1$ // Index file is likely corrupted. Recover by rebuilding the index.
// See http://bugs.eclipse.org/510054
CCorePlugin.log("Failed to open C/C++ index file " + dbFile.getAbsolutePath() //$NON-NLS-1$
+ " - rebuilding the index", e); //$NON-NLS-1$ + " - rebuilding the index", e); //$NON-NLS-1$
dbFile.delete(); dbFile.delete();
fromScratch= true; fromScratch= true;