Skip to content

Commit

Permalink
Revert "Added metrics instrumentation around manager to account for m…
Browse files Browse the repository at this point in the history
…utateMany calls. Refactored metrics initialization."

This reverts commit 43690b3.
  • Loading branch information
dalaro committed May 5, 2015
1 parent 057390f commit 8a1593a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 147 deletions.
Expand Up @@ -31,7 +31,6 @@
import com.thinkaurelius.titan.diskstorage.util.BackendOperation;
import com.thinkaurelius.titan.diskstorage.util.MetricInstrumentedStore;
import com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration;
import com.thinkaurelius.titan.diskstorage.util.MetricInstrumentedStoreManager;
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig;
import com.thinkaurelius.titan.diskstorage.util.time.TimestampProvider;
import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration;
Expand Down Expand Up @@ -79,7 +78,6 @@ public class Backend implements LockerProvider, AutoCloseable {

public static final String ID_STORE_NAME = "titan_ids";

public static final String METRICS_STOREMANAGER_NAME = "storeManager";
public static final String METRICS_MERGED_STORE = "stores";
public static final String METRICS_MERGED_CACHE = "caches";
public static final String METRICS_CACHE_SUFFIX = ".cache";
Expand Down Expand Up @@ -137,12 +135,7 @@ public class Backend implements LockerProvider, AutoCloseable {
public Backend(Configuration configuration) {
this.configuration = configuration;

KeyColumnValueStoreManager manager = getStorageManager(configuration);
if (configuration.get(BASIC_METRICS)) {
storeManager = new MetricInstrumentedStoreManager(manager,METRICS_STOREMANAGER_NAME,configuration.get(METRICS_MERGE_STORES),METRICS_MERGED_STORE);
} else {
storeManager = manager;
}
storeManager = getStorageManager(configuration);
indexes = getIndexes(configuration);
storeFeatures = storeManager.getFeatures();

Expand Down Expand Up @@ -220,9 +213,13 @@ public Locker getLocker(String lockerName) {
*/
public void initialize(Configuration config) {
try {
boolean reportMetrics = configuration.get(BASIC_METRICS);

//EdgeStore & VertexIndexStore
KeyColumnValueStore idStore = storeManager.openDatabase(ID_STORE_NAME);

if (reportMetrics) {
idStore = new MetricInstrumentedStore(idStore, getMetricsStoreName(ID_STORE_NAME));
}
idAuthority = null;
if (storeFeatures.isKeyConsistent()) {
idAuthority = new ConsistentKeyIDAuthority(idStore, storeManager, config);
Expand All @@ -233,6 +230,11 @@ public void initialize(Configuration config) {
KeyColumnValueStore edgeStoreRaw = storeManagerLocking.openDatabase(EDGESTORE_NAME);
KeyColumnValueStore indexStoreRaw = storeManagerLocking.openDatabase(INDEXSTORE_NAME);

if (reportMetrics) {
edgeStoreRaw = new MetricInstrumentedStore(edgeStoreRaw, getMetricsStoreName(EDGESTORE_NAME));
indexStoreRaw = new MetricInstrumentedStore(indexStoreRaw, getMetricsStoreName(INDEXSTORE_NAME));
}

//Configure caches
if (cacheEnabled) {
long expirationTime = configuration.get(DB_CACHE_TIME);
Expand All @@ -256,8 +258,8 @@ public void initialize(Configuration config) {
long edgeStoreCacheSize = Math.round(cacheSizeBytes * EDGESTORE_CACHE_PERCENT);
long indexStoreCacheSize = Math.round(cacheSizeBytes * INDEXSTORE_CACHE_PERCENT);

edgeStore = new ExpirationKCVSCache(edgeStoreRaw,getMetricsCacheName("edgeStore"),expirationTime,cleanWaitTime,edgeStoreCacheSize);
indexStore = new ExpirationKCVSCache(indexStoreRaw,getMetricsCacheName("indexStore"),expirationTime,cleanWaitTime,indexStoreCacheSize);
edgeStore = new ExpirationKCVSCache(edgeStoreRaw,getMetricsCacheName("edgeStore",reportMetrics),expirationTime,cleanWaitTime,edgeStoreCacheSize);
indexStore = new ExpirationKCVSCache(indexStoreRaw,getMetricsCacheName("indexStore",reportMetrics),expirationTime,cleanWaitTime,indexStoreCacheSize);
} else {
edgeStore = new NoKCVSCache(edgeStoreRaw);
indexStore = new NoKCVSCache(indexStoreRaw);
Expand Down Expand Up @@ -374,8 +376,12 @@ public KCVSConfiguration getUserConfiguration() {
return userConfig;
}

private String getMetricsCacheName(String storeName) {
if (!configuration.get(BASIC_METRICS)) return null;
private String getMetricsStoreName(String storeName) {
return configuration.get(METRICS_MERGE_STORES) ? METRICS_MERGED_STORE : storeName;
}

private String getMetricsCacheName(String storeName, boolean reportMetrics) {
if (!reportMetrics) return null;
return configuration.get(METRICS_MERGE_STORES) ? METRICS_MERGED_CACHE : storeName + METRICS_CACHE_SUFFIX;
}

Expand Down

This file was deleted.

Expand Up @@ -204,32 +204,9 @@ public void testReadOperations(boolean cache) {

}

public static final List<String> STORE_NAMES =
ImmutableList.of(Backend.EDGESTORE_NAME,Backend.INDEXSTORE_NAME,Backend.ID_STORE_NAME,Backend.METRICS_STOREMANAGER_NAME);

@Test
public void testSettingProperty() throws Exception {
metricsPrefix = "metrics1";

mgmt.makePropertyKey("foo").dataType(String.class).cardinality(Cardinality.SINGLE).make();
finishSchema();

TitanVertex v = tx.addVertex();
v.property("foo","bar");
tx.commit();


TitanTransaction tx = graph.buildTransaction().checkExternalVertexExistence(false).groupName(metricsPrefix).start();
v = tx.getVertex(v.longId());
v.property("foo","bus");
tx.commit();
printAllMetrics();
verifyStoreMetrics(STORE_NAMES.get(0));
verifyStoreMetrics(STORE_NAMES.get(1));
verifyStoreMetrics(STORE_NAMES.get(2));
verifyStoreMetrics(STORE_NAMES.get(3), ImmutableMap.of(M_MUTATE, 1l));
}

public static final List<String> STORE_NAMES =
ImmutableList.of("edgeStore", "vertexIndexStore", "edgeIndexStore", "idStore");

@Test
@Ignore //TODO: Ignore for now until everything is stable - then do the counting
Expand Down

0 comments on commit 8a1593a

Please sign in to comment.