summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java16
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java5
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
index 3e2894d..f43e043 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
@@ -53,6 +53,8 @@ import com.amazon.carbonado.info.Direction;
import com.amazon.carbonado.info.StorableInfo;
import com.amazon.carbonado.info.StorableIntrospector;
+import com.amazon.carbonado.repo.indexed.IndexEntryAccessCapability;
+
import com.amazon.carbonado.spi.StoragePool;
import com.amazon.carbonado.spi.TransactionPair;
@@ -242,7 +244,19 @@ class ReplicatedRepository
return (C) this;
}
- return mReplicaRepository.getCapability(capabilityType);
+ // Favor replica's indexing capabilities, since they are used for queries.
+ boolean favorReplica =
+ IndexInfoCapability.class.isAssignableFrom(capabilityType) ||
+ IndexEntryAccessCapability.class.isAssignableFrom(capabilityType);
+
+ C masterCap = mMasterRepository.getCapability(capabilityType);
+ C replicaCap = mReplicaRepository.getCapability(capabilityType);
+
+ if (favorReplica) {
+ return replicaCap != null ? replicaCap : masterCap;
+ } else {
+ return masterCap != null ? masterCap : replicaCap;
+ }
}
public void close() {
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java
index da242e6..3ab2146 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java
@@ -36,12 +36,9 @@ import com.amazon.carbonado.spi.BelatedRepositoryCreator;
/**
* Repository builder for the replicated repository.
* <p>
- * In addition to providing all the replica's capabilities, the following extra
- * capabilities are supported:
+ * The following extra capabilities are supported:
* <ul>
* <li>{@link com.amazon.carbonado.capability.ResyncCapability ResyncCapability}
- * <li>{@link com.amazon.carbonado.capability.ShutdownCapability ShutdownCapability}
- * <li>{@link com.amazon.carbonado.capability.StorableInfoCapability StorableInfoCapability}
* </ul>
*
* @author Don Schneider