summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo/replicated
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/replicated')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java8
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java6
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java8
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java2
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java1
5 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java
index 0657d50..f925b20 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java
@@ -41,7 +41,6 @@ import com.amazon.carbonado.info.StorableProperty;
import com.amazon.carbonado.lob.AbstractBlob;
import com.amazon.carbonado.lob.Blob;
-import com.amazon.carbonado.lob.ByteArrayBlob;
/**
* After loading a replica, replaces all Blobs with ReplicatedBlobs.
@@ -145,14 +144,17 @@ class BlobReplicationTrigger<S extends Storable> extends Trigger<S> {
return mReplicaBlob.getLength();
}
+ @Override
public String asString() throws FetchException {
return mReplicaBlob.asString();
}
+ @Override
public String asString(String charsetName) throws FetchException {
return mReplicaBlob.asString(charsetName);
}
+ @Override
public String asString(Charset charset) throws FetchException {
return mReplicaBlob.asString(charset);
}
@@ -281,21 +283,25 @@ class BlobReplicationTrigger<S extends Storable> extends Trigger<S> {
mReplicaOut = replica;
}
+ @Override
public void write(int b) throws IOException {
mMasterOut.write(b);
mReplicaOut.write(b);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
mMasterOut.write(b, off, len);
mReplicaOut.write(b, off, len);
}
+ @Override
public void flush() throws IOException {
mMasterOut.flush();
mReplicaOut.flush();
}
+ @Override
public void close() throws IOException {
mMasterOut.close();
mReplicaOut.close();
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java
index 5da6eed..3300210 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java
@@ -39,7 +39,6 @@ import com.amazon.carbonado.info.StorableProperty;
import com.amazon.carbonado.lob.AbstractClob;
import com.amazon.carbonado.lob.Clob;
-import com.amazon.carbonado.lob.CharArrayClob;
/**
* After loading a replica, replaces all Clobs with ReplicatedClobs.
@@ -143,6 +142,7 @@ class ClobReplicationTrigger<S extends Storable> extends Trigger<S> {
return mReplicaClob.getLength();
}
+ @Override
public String asString() throws FetchException {
return mReplicaClob.asString();
}
@@ -271,21 +271,25 @@ class ClobReplicationTrigger<S extends Storable> extends Trigger<S> {
mReplicaOut = replica;
}
+ @Override
public void write(int c) throws IOException {
mMasterOut.write(c);
mReplicaOut.write(c);
}
+ @Override
public void write(char[] c, int off, int len) throws IOException {
mMasterOut.write(c, off, len);
mReplicaOut.write(c, off, len);
}
+ @Override
public void flush() throws IOException {
mMasterOut.flush();
mReplicaOut.flush();
}
+ @Override
public void close() throws IOException {
mMasterOut.close();
mReplicaOut.close();
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 f43e043..55a1710 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
@@ -152,6 +152,7 @@ class ReplicatedRepository
mMasterRepository = aMasterRepository;
mStoragePool = new StoragePool() {
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws SupportException, RepositoryException
{
@@ -448,10 +449,9 @@ class ReplicatedRepository
masterCursor = masterQuery.fetch();
S lastReplicaEntry = null;
- S lastMasterEntry = null;
S replicaEntry = null;
S masterEntry = null;
-
+
int count = 0, txnCount = 0;
while (true) {
if (throttle != null) {
@@ -531,7 +531,7 @@ class ReplicatedRepository
}
}
}
-
+
if (count++ >= RESYNC_WATERMARK || txnCount >= RESYNC_BATCH_SIZE) {
replicaTxn.commit();
if (replicaCursor != null) {
@@ -567,7 +567,6 @@ class ReplicatedRepository
// Replica cursor is missing an entry so copy it.
resyncTask = prepareResyncTask(replicationTrigger, null, masterEntry);
// Allow master to advance.
- lastMasterEntry = masterEntry;
masterEntry = null;
} else {
// If compare is zero, replicaEntry and masterEntry are
@@ -590,7 +589,6 @@ class ReplicatedRepository
replicaCursor = replicaQuery.fetchAfter(replicaEntry);
}
lastReplicaEntry = replicaEntry;
- lastMasterEntry = masterEntry;
replicaEntry = null;
masterEntry = null;
}
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 3ab2146..cf19600 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java
@@ -85,6 +85,7 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder {
BelatedRepositoryCreator creator = new BelatedRepositoryCreator
(log, mMasterRepositoryBuilder, rootRef, DEFAULT_RETRY_MILLIS) {
+ @Override
protected void createdNotification(Repository repo) {
// Don't need builder any more so restore it.
mMasterRepositoryBuilder.setMaster(originalOption);
@@ -155,6 +156,7 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder {
mMasterRepositoryBuilder = masterRepositoryBuilder;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (null == getReplicaRepositoryBuilder()) {
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java
index 996a9f8..3ab69c0 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java
@@ -22,7 +22,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.amazon.carbonado.FetchException;
-import com.amazon.carbonado.FetchNoneException;
import com.amazon.carbonado.OptimisticLockException;
import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.PersistNoneException;