mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
- better handling of index corruption: do clearIndex at checkRebuild request anyway. Previously we did it in invokeLater and that fails if corruption was detected at shutdown, e.g. IDEA-103038
- avoid multiple logging of corrupted index
This commit is contained in:
@@ -1247,7 +1247,6 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <K> void scheduleRebuild(@NotNull final ID<K, ?> indexId, @NotNull final Throwable e) {
|
public <K> void scheduleRebuild(@NotNull final ID<K, ?> indexId, @NotNull final Throwable e) {
|
||||||
LOG.info(e);
|
|
||||||
requestRebuild(indexId, new Throwable(e));
|
requestRebuild(indexId, new Throwable(e));
|
||||||
try {
|
try {
|
||||||
checkRebuild(indexId, false);
|
checkRebuild(indexId, false);
|
||||||
@@ -1264,19 +1263,20 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
|||||||
if (status.compareAndSet(REQUIRES_REBUILD, REBUILD_IN_PROGRESS)) {
|
if (status.compareAndSet(REQUIRES_REBUILD, REBUILD_IN_PROGRESS)) {
|
||||||
cleanupProcessedFlag();
|
cleanupProcessedFlag();
|
||||||
|
|
||||||
|
try {
|
||||||
|
clearIndex(indexId);
|
||||||
|
} catch (StorageException ex) {
|
||||||
|
requestRebuild(indexId, new Throwable(ex));
|
||||||
|
}
|
||||||
|
|
||||||
final Runnable rebuildRunnable = new Runnable() {
|
final Runnable rebuildRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
clearIndex(indexId);
|
|
||||||
if (!cleanupOnly) {
|
if (!cleanupOnly) {
|
||||||
scheduleIndexRebuild(false);
|
scheduleIndexRebuild(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (StorageException e) {
|
|
||||||
requestRebuild(indexId);
|
|
||||||
LOG.info(e);
|
|
||||||
}
|
|
||||||
finally {
|
finally {
|
||||||
status.compareAndSet(REBUILD_IN_PROGRESS, OK);
|
status.compareAndSet(REBUILD_IN_PROGRESS, OK);
|
||||||
}
|
}
|
||||||
@@ -1581,8 +1581,8 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
|||||||
@Override
|
@Override
|
||||||
public void requestRebuild(ID<?, ?> indexId, Throwable throwable) {
|
public void requestRebuild(ID<?, ?> indexId, Throwable throwable) {
|
||||||
cleanupProcessedFlag();
|
cleanupProcessedFlag();
|
||||||
LOG.info("Rebuild requested for index " + indexId, throwable);
|
boolean requiresRebuildWasSet = ourRebuildStatus.get(indexId).compareAndSet(OK, REQUIRES_REBUILD);
|
||||||
ourRebuildStatus.get(indexId).compareAndSet(OK, REQUIRES_REBUILD);
|
if (requiresRebuildWasSet) LOG.info("Rebuild requested for index " + indexId, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <K, V> UpdatableIndex<K, V, FileContent> getIndex(ID<K, V> indexId) {
|
private <K, V> UpdatableIndex<K, V, FileContent> getIndex(ID<K, V> indexId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user