@Override public FactTable getOrCreateFactTable(int resolution) { String v3TableName = cConf.get(Constants.Metrics.METRICS_TABLE_PREFIX, Constants.Metrics.DEFAULT_METRIC_V3_TABLE_PREFIX) + ".ts." + resolution; TableProperties.Builder props = TableProperties.builder(); // don't add TTL for MAX_RESOLUTION table. CDAP-1626 if (resolution != Integer.MAX_VALUE) { int ttl = cConf.getInt(Constants.Metrics.RETENTION_SECONDS + resolution + Constants.Metrics.RETENTION_SECONDS_SUFFIX); if (ttl > 0) { props.setTTL(ttl); } } // for efficient counters props.setReadlessIncrementSupport(true); // configuring pre-splits props.add(HBaseTableAdmin.PROPERTY_SPLITS, GSON.toJson(FactTable.getSplits(DefaultMetricStore.AGGREGATIONS.size()))); // Disable auto split props.add(HBaseTableAdmin.SPLIT_POLICY, cConf.get(Constants.Metrics.METRICS_TABLE_HBASE_SPLIT_POLICY)); MetricsTable table = getOrCreateResolutionMetricsTable(v3TableName, props, resolution); return new FactTable(table, entityTable.get(), resolution, getRollTime(resolution)); }
@Override public FactTable getOrCreateFactTable(int resolution) { String tableName = cConf.get(Constants.Metrics.METRICS_TABLE_PREFIX, Constants.Metrics.DEFAULT_METRIC_TABLE_PREFIX) + ".ts." + resolution; TableProperties.Builder props = TableProperties.builder(); // don't add TTL for MAX_RESOLUTION table. CDAP-1626 if (resolution != Integer.MAX_VALUE) { int ttl = resolution < 60 ? cConf.getInt(Constants.Metrics.MINIMUM_RESOLUTION_RETENTION_SECONDS) : cConf.getInt(Constants.Metrics.RETENTION_SECONDS + resolution + Constants.Metrics.RETENTION_SECONDS_SUFFIX); if (ttl > 0) { props.setTTL(ttl); } } // for efficient counters props.setReadlessIncrementSupport(true); // configuring pre-splits props.add(HBaseTableAdmin.PROPERTY_SPLITS, GSON.toJson(FactTable.getSplits(DefaultMetricStore.AGGREGATIONS.size()))); // Disable auto split props.add(HBaseTableAdmin.SPLIT_POLICY, cConf.get(Constants.Metrics.METRICS_TABLE_HBASE_SPLIT_POLICY)); MetricsTable table = getOrCreateResolutionMetricsTable(tableName, props, resolution); return new FactTable(table, entityTable.get(), resolution, getRollTime(resolution)); }