Permalink
Browse files

Intermediate check-in for server-side transforms

Conflicts:

	contrib/mongodb/example/MongoDBClient.java
	contrib/mongodb/src/java/voldemort/store/mongodb/MongoDBStorageConfiguration.java
	contrib/mongodb/src/java/voldemort/store/mongodb/MongoDBStorageEngine.java
	contrib/mongodb/test/voldemort/store/mongodb/MongoDBStorageEngineTest.java
	src/java/voldemort/client/AbstractStoreClientFactory.java
	src/java/voldemort/client/SocketStoreClientFactory.java
	src/java/voldemort/server/StoreRepository.java
	src/java/voldemort/server/storage/StorageService.java
	src/java/voldemort/store/invalidmetadata/InvalidMetadataCheckingStore.java
	src/java/voldemort/store/readonly/ReadOnlyStorageEngine.java
	src/java/voldemort/store/rebalancing/RebootstrappingStore.java
	src/java/voldemort/store/rebalancing/RedirectingStore.java
	src/java/voldemort/store/routed/RoutedStore.java
	src/java/voldemort/store/socket/SocketStore.java
	test/integration/voldemort/performance/AbstractLoadTestHarness.java
	test/integration/voldemort/performance/LocalDirectLoadTest.java
	test/integration/voldemort/performance/LocalRoutedStoreLoadTest.java
	test/integration/voldemort/performance/ReadOnlyStorePerformanceTest.java
	test/integration/voldemort/performance/RemoteHttpStoreLoadTest.java
	test/integration/voldemort/performance/RemoteStoreComparisonTest.java
	test/integration/voldemort/performance/RemoteTest.java
	test/integration/voldemort/performance/SemiLocalHttpStoreLoadTest.java
	test/unit/voldemort/server/EndToEndTest.java
	test/unit/voldemort/store/routed/ReadRepairerTest.java
	test/unit/voldemort/store/routed/RoutedStoreTest.java
	test/unit/voldemort/store/socket/AbstractSocketStoreTest.java
  • Loading branch information...
1 parent 304c382 commit 6f1cf577b021124cd3f377420c69299819ee3c40 @rsumbaly rsumbaly committed Aug 26, 2010
Showing with 3,006 additions and 1,372 deletions.
  1. +1 −0 config/single_node_cluster/config/server.properties
  2. +3 −0 config/single_node_cluster/config/stores.xml
  3. +3 −3 contrib/ec2-testing/test/voldemort/utils/Ec2FailureDetectorTest.java
  4. +8 −7 contrib/hadoop-store-builder/test/voldemort/store/readonly/mr/HadoopStoreBuilderTest.java
  5. +1 −1 example/java/voldemort/examples/ClientExample.java
  6. +16 −6 src/java/voldemort/VoldemortClientShell.java
  7. +46 −38 src/java/voldemort/client/AbstractStoreClientFactory.java
  8. +83 −12 src/java/voldemort/client/DefaultStoreClient.java
  9. +5 −5 src/java/voldemort/client/HttpStoreClientFactory.java
  10. +105 −11 src/java/voldemort/client/MockStoreClientFactory.java
  11. +5 −5 src/java/voldemort/client/SocketStoreClientFactory.java
  12. +38 −3 src/java/voldemort/client/StoreClient.java
  13. +12 −6 src/java/voldemort/client/StoreClientFactory.java
  14. +2 −2 src/java/voldemort/client/UpdateAction.java
  15. +3 −0 src/java/voldemort/client/protocol/RequestFormat.java
  16. +4 −0 src/java/voldemort/client/protocol/RequestFormatFactory.java
  17. +2 −0 src/java/voldemort/client/protocol/RequestFormatType.java
  18. +24 −2 src/java/voldemort/client/protocol/pb/ProtoBuffClientRequestFormat.java
  19. +536 −29 src/java/voldemort/client/protocol/pb/VProto.java
  20. +40 −5 src/java/voldemort/client/protocol/vold/VoldemortNativeClientRequestFormat.java
  21. +5 −5 src/java/voldemort/cluster/failuredetector/BasicStoreVerifier.java
  22. +5 −5 src/java/voldemort/cluster/failuredetector/ClientStoreVerifier.java
  23. +4 −4 src/java/voldemort/cluster/failuredetector/ServerStoreVerifier.java
  24. +52 −46 src/java/voldemort/server/StoreRepository.java
  25. +3 −1 src/java/voldemort/server/VoldemortServer.java
  26. +1 −1 src/java/voldemort/server/http/gui/QueryServlet.java
  27. +2 −2 src/java/voldemort/server/http/gui/ReadOnlyStoreManagementServlet.java
  28. +8 −8 src/java/voldemort/server/http/gui/StatusServlet.java
  29. +1 −1 src/java/voldemort/server/jmx/JmxService.java
  30. +1 −1 src/java/voldemort/server/protocol/AbstractRequestHandler.java
  31. +9 −7 src/java/voldemort/server/protocol/SocketRequestHandlerFactory.java
  32. +14 −14 src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java
  33. +3 −2 src/java/voldemort/server/protocol/admin/FetchEntriesStreamRequestHandler.java
  34. +1 −1 src/java/voldemort/server/protocol/admin/FetchMasterEntriesStreamRequestHandler.java
  35. +1 −1 src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java
  36. +2 −2 src/java/voldemort/server/protocol/admin/UpdatePartitionEntriesStreamRequestHandler.java
  37. +31 −9 src/java/voldemort/server/protocol/pb/ProtoBuffRequestHandler.java
  38. +44 −10 src/java/voldemort/server/protocol/vold/VoldemortNativeRequestHandler.java
  39. +3 −3 src/java/voldemort/server/scheduler/DataCleanupJob.java
  40. +3 −3 src/java/voldemort/server/scheduler/RebalancingJob.java
  41. +5 −4 src/java/voldemort/server/scheduler/SlopPusherJob.java
  42. +55 −49 src/java/voldemort/server/storage/StorageService.java
  43. +11 −10 src/java/voldemort/store/DelegatingStore.java
  44. +1 −1 src/java/voldemort/store/StorageConfiguration.java
  45. +1 −1 src/java/voldemort/store/StorageEngine.java
  46. +5 −4 src/java/voldemort/store/Store.java
  47. +5 −1 src/java/voldemort/store/StoreDefinition.java
  48. +1 −1 src/java/voldemort/store/StoreDefinitionBuilder.java
  49. +1 −1 src/java/voldemort/store/StoreRequest.java
  50. +10 −5 src/java/voldemort/store/StoreUtils.java
  51. +1 −1 src/java/voldemort/store/bdb/BdbStorageConfiguration.java
  52. +14 −9 src/java/voldemort/store/bdb/BdbStorageEngine.java
  53. +25 −9 src/java/voldemort/store/compress/CompressingStore.java
  54. +8 −5 src/java/voldemort/store/configuration/ConfigurationStorageEngine.java
  55. +8 −6 src/java/voldemort/store/gzip/GzipStore.java
  56. +9 −4 src/java/voldemort/store/http/HttpStore.java
  57. +14 −13 src/java/voldemort/store/invalidmetadata/InvalidMetadataCheckingStore.java
  58. +8 −8 src/java/voldemort/store/logging/LoggingStore.java
  59. +2 −2 src/java/voldemort/store/memory/CacheStorageConfiguration.java
  60. +3 −3 src/java/voldemort/store/memory/InMemoryStorageConfiguration.java
  61. +7 −6 src/java/voldemort/store/memory/InMemoryStorageEngine.java
  62. +29 −22 src/java/voldemort/store/metadata/MetadataStore.java
  63. +1 −1 src/java/voldemort/store/mysql/MysqlStorageConfiguration.java
  64. +10 −8 src/java/voldemort/store/mysql/MysqlStorageEngine.java
  65. +9 −8 src/java/voldemort/store/nonblockingstore/ThreadPoolBasedNonblockingStoreImpl.java
  66. +1 −1 src/java/voldemort/store/readonly/ReadOnlyStorageConfiguration.java
  67. +7 −5 src/java/voldemort/store/readonly/ReadOnlyStorageEngine.java
  68. +9 −8 src/java/voldemort/store/rebalancing/RebootstrappingStore.java
  69. +90 −75 src/java/voldemort/store/rebalancing/RedirectingStore.java
  70. +3 −3 src/java/voldemort/store/routed/PipelineRoutedStore.java
  71. +6 −6 src/java/voldemort/store/routed/RoutedStore.java
  72. +4 −4 src/java/voldemort/store/routed/RoutedStoreFactory.java
  73. +40 −22 src/java/voldemort/store/routed/ThreadPoolRoutedStore.java
  74. +3 −3 src/java/voldemort/store/routed/action/PerformSerialGetAllRequests.java
  75. +2 −2 src/java/voldemort/store/routed/action/PerformSerialPutRequests.java
  76. +3 −3 src/java/voldemort/store/routed/action/PerformSerialRequests.java
  77. +2 −2 src/java/voldemort/store/routed/action/PerformZoneSerialRequests.java
  78. +14 −11 src/java/voldemort/store/serialized/SerializingStorageEngine.java
  79. +43 −15 src/java/voldemort/store/serialized/SerializingStore.java
  80. +11 −3 src/java/voldemort/store/slop/Slop.java
  81. +12 −8 src/java/voldemort/store/slop/SlopDetectingStore.java
  82. +25 −14 src/java/voldemort/store/slop/SloppyStore.java
  83. +6 −5 src/java/voldemort/store/socket/SocketStore.java
  84. +9 −8 src/java/voldemort/store/stats/StatTrackingStore.java
  85. +7 −6 src/java/voldemort/store/versioned/InconsistencyResolvingStore.java
  86. +5 −4 src/java/voldemort/store/versioned/VersionIncrementingStore.java
  87. +2 −2 src/java/voldemort/store/views/AbstractViewTransformation.java
  88. +2 −2 src/java/voldemort/store/views/View.java
  89. +3 −3 src/java/voldemort/store/views/ViewStorageConfiguration.java
  90. +37 −22 src/java/voldemort/store/views/ViewStorageEngine.java
  91. +12 −0 src/java/voldemort/xml/StoreDefinitionsMapper.java
  92. +1 −0 src/java/voldemort/xml/stores.xsd
  93. +8 −0 src/proto/voldemort-client.proto
  94. +11 −8 test/common/voldemort/MutableStoreVerifier.java
  95. +26 −24 test/common/voldemort/ServerTestUtils.java
  96. +9 −9 test/common/voldemort/StaticStoreClientFactory.java
  97. +2 −2 test/common/voldemort/TestUtils.java
  98. +35 −1 test/common/voldemort/config/view-store.xml
  99. +5 −4 test/common/voldemort/store/DoNothingStore.java
  100. +8 −7 test/common/voldemort/store/FailingReadsStore.java
  101. +5 −4 test/common/voldemort/store/FailingStore.java
  102. +2 −2 test/common/voldemort/store/ForceFailStore.java
  103. +5 −5 test/common/voldemort/store/RandomlyFailingDelegatingStore.java
  104. +9 −8 test/common/voldemort/store/SleepyStore.java
  105. +7 −6 test/integration/voldemort/CatBdbStore.java
  106. +5 −5 test/integration/voldemort/InMemoryMultiThreadedTest.java
  107. +6 −5 test/integration/voldemort/MultithreadedStressTest.java
  108. +2 −2 test/integration/voldemort/TestClientShutdown.java
  109. +3 −3 test/integration/voldemort/performance/CacheStorageEnginePerformanceTest.java
  110. +6 −5 test/integration/voldemort/performance/ReadOnlyStorePerformanceTest.java
  111. +40 −46 test/integration/voldemort/performance/RemoteDataGenerator.java
  112. +14 −14 test/integration/voldemort/performance/RemoteStoreComparisonTest.java
  113. +9 −7 test/integration/voldemort/performance/RemoteTest.java
  114. +7 −3 test/integration/voldemort/performance/benchmark/Benchmark.java
  115. +95 −0 test/integration/voldemort/performance/benchmark/BenchmarkViews.java
  116. +70 −6 test/integration/voldemort/performance/benchmark/VoldemortWrapper.java
  117. +1 −1 test/integration/voldemort/store/noop/NoopStorageConfiguration.java
  118. +7 −5 test/integration/voldemort/store/noop/NoopStorageEngine.java
  119. +2 −2 test/integration/voldemort/store/pausable/PausableStorageConfiguration.java
  120. +9 −9 test/integration/voldemort/store/pausable/PausableStorageEngine.java
  121. +12 −12 test/unit/voldemort/client/AbstractAdminServiceFilterTest.java
  122. +2 −2 test/unit/voldemort/client/AbstractStoreClientFactoryTest.java
  123. +37 −32 test/unit/voldemort/client/AdminServiceBasicTest.java
  124. +7 −5 test/unit/voldemort/client/AdminServiceFailureTest.java
  125. +1 −1 test/unit/voldemort/client/AdminServiceFilterTest.java
  126. +1 −1 test/unit/voldemort/client/AdminServiceMultiJVMTest.java
  127. +9 −6 test/unit/voldemort/client/DefaultStoreClientTest.java
  128. +54 −49 test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java
  129. +36 −17 test/unit/voldemort/protocol/AbstractRequestFormatTest.java
  130. +10 −10 test/unit/voldemort/scheduled/DataCleanupJobTest.java
  131. +8 −8 test/unit/voldemort/scheduled/SlopPusherTest.java
  132. +1 −1 test/unit/voldemort/server/EndToEndTest.java
  133. +5 −4 test/unit/voldemort/store/AbstractByteArrayStoreTest.java
  134. +29 −29 test/unit/voldemort/store/AbstractStorageEngineTest.java
  135. +41 −40 test/unit/voldemort/store/AbstractStoreTest.java
  136. +42 −18 test/unit/voldemort/store/bdb/BdbSplitStorageEngineTest.java
  137. +6 −4 test/unit/voldemort/store/bdb/BdbStorageEngineTest.java
  138. +3 −3 test/unit/voldemort/store/compress/CompressingStoreTest.java
  139. +25 −17 test/unit/voldemort/store/configuration/ConfigurationStorageEngineTest.java
  140. +5 −3 test/unit/voldemort/store/http/HttpStoreTest.java
  141. +6 −7 test/unit/voldemort/store/invalidmetadata/InvalidMetadataCheckingStoreTest.java
  142. +5 −4 test/unit/voldemort/store/invalidmetadata/ServerSideRoutingTest.java
  143. +3 −3 test/unit/voldemort/store/logging/LoggingStoreTest.java
  144. +7 −6 test/unit/voldemort/store/memory/CacheStorageEngineTest.java
  145. +4 −4 test/unit/voldemort/store/memory/InMemoryStorageEngineTest.java
  146. +15 −14 test/unit/voldemort/store/metadata/MetadataStoreTest.java
  147. +1 −1 test/unit/voldemort/store/mysql/MysqlStorageEngineTest.java
  148. +13 −9 test/unit/voldemort/store/readonly/ReadOnlyStorageEngineTest.java
  149. +17 −12 test/unit/voldemort/store/readonly/ReadOnlyStorageEngineTestInstance.java
  150. +32 −22 test/unit/voldemort/store/rebalancing/RedirectingStoreTest.java
  151. +8 −8 test/unit/voldemort/store/routed/ReadRepairerTest.java
  152. +108 −102 test/unit/voldemort/store/routed/RoutedStoreTest.java
  153. +4 −3 test/unit/voldemort/store/serialized/SerializingStoreTest.java
  154. +11 −11 test/unit/voldemort/store/slop/SloppyStoreTest.java
  155. +8 −7 test/unit/voldemort/store/socket/AbstractSocketStoreTest.java
  156. +56 −0 test/unit/voldemort/store/views/RangeFilterView.java
  157. +16 −5 test/unit/voldemort/store/views/UpperCaseView.java
  158. +130 −19 test/unit/voldemort/store/views/ViewStorageEngineTest.java
  159. +88 −0 test/unit/voldemort/store/views/ViewTransformsTest.java
@@ -23,4 +23,5 @@ mysql.database=test
#NIO connector settings.
enable.nio.connector=false
+request.format=vp3
storage.configs=voldemort.store.bdb.BdbStorageConfiguration, voldemort.store.readonly.ReadOnlyStorageConfiguration
@@ -22,5 +22,8 @@
<value-serializer>
<type>string</type>
</value-serializer>
+ <transforms-serializer>
+ <type>string</type>
+ </transforms-serializer>
</view>
</stores>
@@ -70,7 +70,7 @@
private static Map<String, Integer> nodeIds;
private FailureDetector failureDetector;
- private StoreClient<String, String> store;
+ private StoreClient<String, String, String> store;
private static final Logger logger = Logger.getLogger(Ec2FailureDetectorTest.class);
@@ -233,11 +233,11 @@ public void run() {
assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
}
- private void test(StoreClient<String, String> store) {
+ private void test(StoreClient<String, String, String> store) {
test(store, 1000);
}
- private void test(StoreClient<String, String> store, int tests) {
+ private void test(StoreClient<String, String, String> store, int tests) {
for(int i = 0; i < tests; i++) {
try {
store.get("test_" + i);
@@ -216,16 +216,17 @@ public void testHadoopBuild() throws Exception {
// open store
@SuppressWarnings("unchecked")
Serializer<Object> serializer = (Serializer<Object>) new DefaultSerializerFactory().getSerializer(serDef);
- Store<Object, Object> store = SerializingStore.wrap(new ReadOnlyStorageEngine(storeName,
- new BinarySearchStrategy(),
- storeDir,
- 1),
- serializer,
- serializer);
+ Store<Object, Object, Object> store = SerializingStore.wrap(new ReadOnlyStorageEngine(storeName,
+ new BinarySearchStrategy(),
+ storeDir,
+ 1),
+ serializer,
+ serializer,
+ serializer);
// check values
for(Map.Entry<String, String> entry: values.entrySet()) {
- List<Versioned<Object>> found = store.get(entry.getKey());
+ List<Versioned<Object>> found = store.get(entry.getKey(), null);
assertEquals("Incorrect number of results", 1, found.size());
assertEquals(entry.getValue(), found.get(0).getValue());
}
@@ -30,7 +30,7 @@ public static void main(String[] args) {
String bootstrapUrl = "tcp://localhost:6666";
StoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
- StoreClient<String, String> client = factory.getStoreClient("my_store_name");
+ StoreClient<String, String, String> client = factory.getStoreClient("my_store_name");
// get the value
Versioned<String> version = client.get("some_key");
@@ -34,6 +34,7 @@
import voldemort.client.DefaultStoreClient;
import voldemort.client.SocketStoreClientFactory;
import voldemort.client.StoreClientFactory;
+import voldemort.client.protocol.RequestFormatType;
import voldemort.cluster.Node;
import voldemort.cluster.failuredetector.FailureDetector;
import voldemort.serialization.SerializationException;
@@ -51,7 +52,7 @@
private static final String PROMPT = "> ";
- private static DefaultStoreClient<Object, Object> client;
+ private static DefaultStoreClient<Object, Object, Object> client;
public static void main(String[] args) throws Exception {
@@ -86,7 +87,8 @@ public static void main(String[] args) throws Exception {
Utils.croak("Failure to open input stream: " + e.getMessage());
}
- ClientConfig clientConfig = new ClientConfig().setBootstrapUrls(bootstrapUrl);
+ ClientConfig clientConfig = new ClientConfig().setBootstrapUrls(bootstrapUrl)
+ .setRequestFormatType(RequestFormatType.VOLDEMORT_V3);
if(options.has("client-zone-id")) {
clientConfig.setEnablePipelineRoutedStore(true);
@@ -96,7 +98,7 @@ public static void main(String[] args) throws Exception {
StoreClientFactory factory = new SocketStoreClientFactory(clientConfig);
try {
- client = (DefaultStoreClient<Object, Object>) factory.getStoreClient(storeName);
+ client = (DefaultStoreClient<Object, Object, Object>) factory.getStoreClient(storeName);
} catch(Exception e) {
Utils.croak("Could not connect to server: " + e.getMessage());
}
@@ -121,8 +123,12 @@ private static void processCommands(StoreClientFactory factory,
try {
if(line.toLowerCase().startsWith("put")) {
JsonReader jsonReader = new JsonReader(new StringReader(line.substring("put".length())));
- client.put(tightenNumericTypes(jsonReader.read()),
- tightenNumericTypes(jsonReader.read()));
+ Object key = tightenNumericTypes(jsonReader.read());
+ Object value = tightenNumericTypes(jsonReader.read());
+ if(jsonReader.hasMore())
+ client.put(key, value, tightenNumericTypes(jsonReader.read()));
+ else
+ client.put(key, value);
} else if(line.toLowerCase().startsWith("getall")) {
JsonReader jsonReader = new JsonReader(new StringReader(line.substring("getall".length())));
List<Object> keys = new ArrayList<Object>();
@@ -144,7 +150,11 @@ private static void processCommands(StoreClientFactory factory,
}
} else if(line.toLowerCase().startsWith("get")) {
JsonReader jsonReader = new JsonReader(new StringReader(line.substring("get".length())));
- printVersioned(client.get(tightenNumericTypes(jsonReader.read())));
+ Object key = tightenNumericTypes(jsonReader.read());
+ if(jsonReader.hasMore())
+ printVersioned(client.get(key, tightenNumericTypes(jsonReader.read())));
+ else
+ printVersioned(client.get(key));
} else if(line.toLowerCase().startsWith("delete")) {
JsonReader jsonReader = new JsonReader(new StringReader(line.substring("delete".length())));
client.delete(tightenNumericTypes(jsonReader.read()));
@@ -32,6 +32,7 @@
import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
import voldemort.cluster.failuredetector.FailureDetector;
+import voldemort.serialization.IdentitySerializer;
import voldemort.serialization.Serializer;
import voldemort.serialization.SerializerDefinition;
import voldemort.serialization.SerializerFactory;
@@ -119,19 +120,18 @@ public AbstractStoreClientFactory(ClientConfig config) {
}
}
- public <K, V> StoreClient<K, V> getStoreClient(String storeName) {
+ public <K, V, T> StoreClient<K, V, T> getStoreClient(String storeName) {
return getStoreClient(storeName, null);
}
- public <K, V> StoreClient<K, V> getStoreClient(String storeName,
- InconsistencyResolver<Versioned<V>> resolver) {
-
- return new DefaultStoreClient<K, V>(storeName, resolver, this, 3);
+ public <K, V, T> StoreClient<K, V, T> getStoreClient(String storeName,
+ InconsistencyResolver<Versioned<V>> resolver) {
+ return new DefaultStoreClient<K, V, T>(storeName, resolver, this, 3);
}
@SuppressWarnings("unchecked")
- public <K, V> Store<K, V> getRawStore(String storeName,
- InconsistencyResolver<Versioned<V>> resolver) {
+ public <K, V, T> Store<K, V, T> getRawStore(String storeName,
+ InconsistencyResolver<Versioned<V>> resolver) {
// Get cluster and store metadata
String clusterXml = bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY, bootstrapUrls);
Cluster cluster = clusterMapper.readCluster(new StringReader(clusterXml), false);
@@ -148,28 +148,28 @@ public AbstractStoreClientFactory(ClientConfig config) {
boolean repairReads = !storeDef.isView();
// construct mapping
- Map<Integer, Store<ByteArray, byte[]>> clientMapping = Maps.newHashMap();
+ Map<Integer, Store<ByteArray, byte[], byte[]>> clientMapping = Maps.newHashMap();
Map<Integer, NonblockingStore> nonblockingStores = Maps.newHashMap();
for(Node node: cluster.getNodes()) {
- Store<ByteArray, byte[]> store = getStore(storeDef.getName(),
- node.getHost(),
- getPort(node),
- this.requestFormatType);
- Store<ByteArray, byte[]> loggingStore = new LoggingStore(store);
+ Store<ByteArray, byte[], byte[]> store = getStore(storeDef.getName(),
+ node.getHost(),
+ getPort(node),
+ this.requestFormatType);
+ Store<ByteArray, byte[], byte[]> loggingStore = new LoggingStore(store);
clientMapping.put(node.getId(), loggingStore);
NonblockingStore nonblockingStore = routedStoreFactory.toNonblockingStore(store);
nonblockingStores.put(node.getId(), nonblockingStore);
}
- Store<ByteArray, byte[]> store = routedStoreFactory.create(cluster,
- storeDef,
- clientMapping,
- nonblockingStores,
- repairReads,
- clientZoneId,
- getFailureDetector());
+ Store<ByteArray, byte[], byte[]> store = routedStoreFactory.create(cluster,
+ storeDef,
+ clientMapping,
+ nonblockingStores,
+ repairReads,
+ clientZoneId,
+ getFailureDetector());
if(isJmxEnabled) {
StatTrackingStore statStore = new StatTrackingStore(store, this.stats);
@@ -188,15 +188,21 @@ public AbstractStoreClientFactory(ClientConfig config) {
Serializer<K> keySerializer = (Serializer<K>) serializerFactory.getSerializer(storeDef.getKeySerializer());
Serializer<V> valueSerializer = (Serializer<V>) serializerFactory.getSerializer(storeDef.getValueSerializer());
- Store<K, V> serializedStore = SerializingStore.wrap(store, keySerializer, valueSerializer);
+ Serializer<T> transformsSerializer = (Serializer<T>) serializerFactory.getSerializer(storeDef.getTransformsSerializer() != null ? storeDef.getTransformsSerializer()
+ : new SerializerDefinition("identity"));
+
+ Store<K, V, T> serializedStore = SerializingStore.wrap(store,
+ keySerializer,
+ valueSerializer,
+ transformsSerializer);
// Add inconsistency resolving decorator, using their inconsistency
// resolver (if they gave us one)
InconsistencyResolver<Versioned<V>> secondaryResolver = resolver == null ? new TimeBasedInconsistencyResolver()
: resolver;
- serializedStore = new InconsistencyResolvingStore<K, V>(serializedStore,
- new ChainedResolver<Versioned<V>>(new VectorClockInconsistencyResolver(),
- secondaryResolver));
+ serializedStore = new InconsistencyResolvingStore<K, V, T>(serializedStore,
+ new ChainedResolver<Versioned<V>>(new VectorClockInconsistencyResolver(),
+ secondaryResolver));
return serializedStore;
}
@@ -206,8 +212,9 @@ protected abstract FailureDetector initFailureDetector(final ClientConfig config
public FailureDetector getFailureDetector() {
// first check: avoids locking as the field is volatile
FailureDetector result = failureDetector;
- if (result == null) {
- String clusterXml = bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY, bootstrapUrls);
+ if(result == null) {
+ String clusterXml = bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY,
+ bootstrapUrls);
Cluster cluster = clusterMapper.readCluster(new StringReader(clusterXml), false);
synchronized(this) {
// second check: avoids double initialization
@@ -253,14 +260,15 @@ public String bootstrapMetadataWithRetries(String key) {
private String bootstrapMetadata(String key, URI[] urls) {
for(URI url: urls) {
try {
- Store<ByteArray, byte[]> remoteStore = getStore(MetadataStore.METADATA_STORE_NAME,
- url.getHost(),
- url.getPort(),
- this.requestFormatType);
- Store<String, String> store = SerializingStore.wrap(remoteStore,
- new StringSerializer("UTF-8"),
- new StringSerializer("UTF-8"));
- List<Versioned<String>> found = store.get(key);
+ Store<ByteArray, byte[], byte[]> remoteStore = getStore(MetadataStore.METADATA_STORE_NAME,
+ url.getHost(),
+ url.getPort(),
+ this.requestFormatType);
+ Store<String, String, byte[]> store = SerializingStore.wrap(remoteStore,
+ new StringSerializer("UTF-8"),
+ new StringSerializer("UTF-8"),
+ new IdentitySerializer());
+ List<Versioned<String>> found = store.get(key, null);
if(found.size() == 1)
return found.get(0).getValue();
} catch(Exception e) {
@@ -300,10 +308,10 @@ else if(uri.getPort() < 0)
return uris;
}
- protected abstract Store<ByteArray, byte[]> getStore(String storeName,
- String host,
- int port,
- RequestFormatType type);
+ protected abstract Store<ByteArray, byte[], byte[]> getStore(String storeName,
+ String host,
+ int port,
+ RequestFormatType type);
protected abstract int getPort(Node node);
Oops, something went wrong.

0 comments on commit 6f1cf57

Please sign in to comment.