Skip to content

Commit

Permalink
OAK-5465 - Remove the useless cache in StandbyClientSyncExecution
Browse files Browse the repository at this point in the history
The segments loaded by StandbyClientSyncExecution are guaranteed not to already
exist locally and are processed only once. The cache is useless and can be
removed.


git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1779175 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
francescomari committed Jan 17, 2017
1 parent 9b627e6 commit 0abae46
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@

package org.apache.jackrabbit.oak.segment.standby.client;

import static com.google.common.collect.Maps.newHashMap;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import javax.annotation.Nullable;

import com.google.common.base.Supplier;
import org.apache.jackrabbit.oak.segment.RecordId;
import org.apache.jackrabbit.oak.segment.Segment;
import org.apache.jackrabbit.oak.segment.SegmentId;
import org.apache.jackrabbit.oak.segment.SegmentNodeBuilder;
import org.apache.jackrabbit.oak.segment.SegmentNodeState;
Expand All @@ -54,8 +50,6 @@ class StandbyClientSyncExecution {

private final Supplier<Boolean> running;

private final Map<UUID, Segment> cache = newHashMap();

StandbyClientSyncExecution(FileStore store, StandbyClient client, Supplier<Boolean> running) {
this.store = store;
this.client = client;
Expand Down Expand Up @@ -218,13 +212,6 @@ private boolean isLocal(UUID id) {
}

private void copySegmentFromPrimary(UUID uuid) throws Exception {
Segment result = cache.get(uuid);

if (result != null) {
log.debug("Segment {} was found in the local cache", uuid);
return;
}

byte[] data = client.getSegment(uuid.toString());

if (data == null) {
Expand All @@ -235,8 +222,6 @@ private void copySegmentFromPrimary(UUID uuid) throws Exception {
long lsb = uuid.getLeastSignificantBits();
SegmentId segmentId = store.newSegmentId(msb, lsb);
store.writeSegment(segmentId, data, 0, data.length);
result = segmentId.getSegment();
cache.put(uuid, result);
}

}
Expand Down

0 comments on commit 0abae46

Please sign in to comment.