mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] make index version depend on storage version
This commit is contained in:
@@ -52,7 +52,7 @@ public class VcsLogStorageImpl implements Disposable, VcsLogStorage {
|
||||
@NotNull private static final String REFS_STORAGE = "refs";
|
||||
@NotNull public static final VcsLogStorage EMPTY = new EmptyLogStorage();
|
||||
|
||||
private static final int VERSION = 5;
|
||||
public static final int VERSION = 5;
|
||||
@NotNull private static final String ROOT_STORAGE_KIND = "roots";
|
||||
private static final int ROOTS_STORAGE_VERSION = 0;
|
||||
|
||||
|
||||
+4
-3
@@ -37,17 +37,18 @@ import java.util.Set;
|
||||
|
||||
public class VcsLogMessagesTrigramIndex extends VcsLogFullDetailsIndex<Void> {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogMessagesTrigramIndex.class);
|
||||
private static final int VERSION = 0;
|
||||
private static final String TRIGRAMS = "trigrams";
|
||||
private static final int VALUE = 239;
|
||||
|
||||
@NotNull private final PersistentHashMap<Integer, Integer> myNoTrigramsCommits;
|
||||
|
||||
public VcsLogMessagesTrigramIndex(@NotNull String logId, @NotNull Disposable disposableParent) throws IOException {
|
||||
super(logId, TRIGRAMS, VERSION, new TrigramMessageIndexer(), ScalarIndexExtension.VOID_DATA_EXTERNALIZER, disposableParent);
|
||||
super(logId, TRIGRAMS, VcsLogPersistentIndex.getVersion(), new TrigramMessageIndexer(), ScalarIndexExtension.VOID_DATA_EXTERNALIZER,
|
||||
disposableParent);
|
||||
|
||||
myNoTrigramsCommits =
|
||||
PersistentUtil.createPersistentHashMap(EnumeratorIntegerDescriptor.INSTANCE, "index-no-" + TRIGRAMS, logId, VERSION);
|
||||
PersistentUtil.createPersistentHashMap(EnumeratorIntegerDescriptor.INSTANCE, "index-no-" + TRIGRAMS, logId,
|
||||
VcsLogPersistentIndex.getVersion());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.stream.Collectors;
|
||||
public class VcsLogPathsIndex extends VcsLogFullDetailsIndex<Integer> {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogPathsIndex.class);
|
||||
private static final String NAME = "paths";
|
||||
private static final int VERSION = 0;
|
||||
private static final int VALUE = 239;
|
||||
|
||||
@NotNull private final PersistentHashMap<Integer, Integer> myEmptyCommits;
|
||||
@@ -53,11 +52,13 @@ public class VcsLogPathsIndex extends VcsLogFullDetailsIndex<Integer> {
|
||||
public VcsLogPathsIndex(@NotNull String logId,
|
||||
@NotNull Set<VirtualFile> roots,
|
||||
@NotNull Disposable disposableParent) throws IOException {
|
||||
super(logId, NAME, VERSION, new PathsIndexer(
|
||||
PersistentUtil.createPersistentEnumerator(EnumeratorStringDescriptor.INSTANCE, "index-paths-ids", logId, VERSION), roots),
|
||||
super(logId, NAME, VcsLogPersistentIndex.getVersion(), new PathsIndexer(
|
||||
PersistentUtil.createPersistentEnumerator(EnumeratorStringDescriptor.INSTANCE, "index-paths-ids", logId,
|
||||
VcsLogPersistentIndex.getVersion()), roots),
|
||||
new NullableIntKeyDescriptor(), disposableParent);
|
||||
|
||||
myEmptyCommits = PersistentUtil.createPersistentHashMap(EnumeratorIntegerDescriptor.INSTANCE, "index-no-" + NAME, logId, VERSION);
|
||||
myEmptyCommits = PersistentUtil.createPersistentHashMap(EnumeratorIntegerDescriptor.INSTANCE, "index-no-" + NAME, logId,
|
||||
VcsLogPersistentIndex.getVersion());
|
||||
myPathsIndexer = (PathsIndexer)myIndexer;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.intellij.util.io.PersistentMap;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.InMemoryMap;
|
||||
import com.intellij.vcs.log.data.TroveUtil;
|
||||
import com.intellij.vcs.log.data.VcsLogStorageImpl;
|
||||
import com.intellij.vcs.log.data.VcsUserRegistryImpl;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogUserFilterImpl;
|
||||
import com.intellij.vcs.log.util.PersistentUtil;
|
||||
@@ -60,6 +61,7 @@ import java.util.stream.IntStream;
|
||||
public class VcsLogPersistentIndex implements VcsLogIndex, Disposable {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogPersistentIndex.class);
|
||||
private static final int BATCH_SIZE = 1000;
|
||||
private static final int VERSION = 0;
|
||||
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final Consumer<Exception> myFatalErrorsConsumer;
|
||||
@@ -110,6 +112,10 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable {
|
||||
Disposer.register(disposableParent, this);
|
||||
}
|
||||
|
||||
public static int getVersion() {
|
||||
return VcsLogStorageImpl.VERSION + VERSION;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <I extends VcsLogFullDetailsIndex> I createIndex(@NotNull ThrowableComputable<I, IOException> computable) {
|
||||
try {
|
||||
|
||||
@@ -34,13 +34,13 @@ import java.util.Set;
|
||||
|
||||
public class VcsLogUserIndex extends VcsLogFullDetailsIndex<Void> {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogUserIndex.class);
|
||||
private static final int VERSION = 0;
|
||||
@NotNull private final VcsUserRegistryImpl myUserRegistry;
|
||||
|
||||
public VcsLogUserIndex(@NotNull String logId,
|
||||
@NotNull VcsUserRegistryImpl userRegistry,
|
||||
@NotNull Disposable disposableParent) throws IOException {
|
||||
super(logId, "users", VERSION, new UserIndexer(userRegistry), ScalarIndexExtension.VOID_DATA_EXTERNALIZER, disposableParent);
|
||||
super(logId, "users", VcsLogPersistentIndex.getVersion(), new UserIndexer(userRegistry), ScalarIndexExtension.VOID_DATA_EXTERNALIZER,
|
||||
disposableParent);
|
||||
myUserRegistry = userRegistry;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user