Skip to content

Commit

Permalink
Enable host affinity in RocksDB table provider
Browse files Browse the repository at this point in the history
  • Loading branch information
weisong44 committed Aug 7, 2018
1 parent a15a7c9 commit 78e1b84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -21,6 +21,7 @@
import java.util.HashMap;
import java.util.Map;

import org.apache.samza.config.ClusterManagerConfig;
import org.apache.samza.config.JavaTableConfig;
import org.apache.samza.config.StorageConfig;
import org.apache.samza.table.TableSpec;
Expand Down Expand Up @@ -56,6 +57,9 @@ public Map<String, String> generateConfig(Map<String, String> config) {
tableConfig.put(realKey, v);
});

// Enable host affinity
tableConfig.put(ClusterManagerConfig.CLUSTER_MANAGER_HOST_AFFINITY_ENABLED, "true");

logger.info("Generated configuration for table " + tableSpec.getId());

return tableConfig;
Expand Down
Expand Up @@ -81,7 +81,7 @@ public void testWithTableDescriptorsProviderClass() throws Exception {
String tableRewriterName = "tableRewriter";
configs.put("tables.descriptors.provider.class", MySampleTableDescriptorsProvider.class.getName());
Config resultConfig = new MySampleTableConfigRewriter().rewrite(tableRewriterName, new MapConfig(configs));
Assert.assertTrue(resultConfig.size() == 17);
Assert.assertTrue(resultConfig.size() == 18);

String localTableId = "local-table-1";
String remoteTableId = "remote-table-1";
Expand Down

0 comments on commit 78e1b84

Please sign in to comment.