Search in sources :

Example 1 with ExpiredLoggableInfo

use of jetbrains.exodus.log.ExpiredLoggableInfo in project xodus by JetBrains.

the class ReadWriteTransaction method doCommit.

Iterable<ExpiredLoggableInfo>[] doCommit(@NotNull final MetaTree.Proto[] out) {
    final Set<Map.Entry<Integer, ITreeMutable>> entries = mutableTrees.entrySet();
    final Set<Map.Entry<Long, Pair<String, ITree>>> removedEntries = removedStores.entrySet();
    final int size = entries.size() + removedEntries.size();
    // noinspection unchecked
    final Iterable<ExpiredLoggableInfo>[] expiredLoggables = new Iterable[size + 1];
    int i = 0;
    final ITreeMutable metaTreeMutable = getMetaTree().tree.getMutableCopy();
    for (final Map.Entry<Long, Pair<String, ITree>> entry : removedEntries) {
        final Pair<String, ITree> value = entry.getValue();
        MetaTree.removeStore(metaTreeMutable, value.getFirst(), entry.getKey());
        expiredLoggables[i++] = TreeMetaInfo.getTreeLoggables(value.getSecond());
    }
    removedStores.clear();
    for (final Map.Entry<String, TreeMetaInfo> entry : createdStores.entrySet()) {
        MetaTree.addStore(metaTreeMutable, entry.getKey(), entry.getValue());
    }
    createdStores.clear();
    final Collection<ExpiredLoggableInfo> last;
    for (final Map.Entry<Integer, ITreeMutable> entry : entries) {
        final ITreeMutable treeMutable = entry.getValue();
        expiredLoggables[i++] = treeMutable.getExpiredLoggables();
        MetaTree.saveTree(metaTreeMutable, treeMutable);
    }
    clearImmutableTrees();
    mutableTrees.clear();
    expiredLoggables[i] = last = metaTreeMutable.getExpiredLoggables();
    out[0] = MetaTree.saveMetaTree(metaTreeMutable, getEnvironment(), last);
    return expiredLoggables;
}
Also used : TreeMetaInfo(jetbrains.exodus.tree.TreeMetaInfo) ITree(jetbrains.exodus.tree.ITree) ITreeMutable(jetbrains.exodus.tree.ITreeMutable) ExpiredLoggableInfo(jetbrains.exodus.log.ExpiredLoggableInfo) LongHashMap(jetbrains.exodus.core.dataStructures.hash.LongHashMap) Pair(jetbrains.exodus.core.dataStructures.Pair)

Aggregations

Pair (jetbrains.exodus.core.dataStructures.Pair)1 LongHashMap (jetbrains.exodus.core.dataStructures.hash.LongHashMap)1 ExpiredLoggableInfo (jetbrains.exodus.log.ExpiredLoggableInfo)1 ITree (jetbrains.exodus.tree.ITree)1 ITreeMutable (jetbrains.exodus.tree.ITreeMutable)1 TreeMetaInfo (jetbrains.exodus.tree.TreeMetaInfo)1