MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / updateBaseTime

Method updateBaseTime

src/core/IncomingDataPoints.java:245–260  ·  view source on GitHub ↗

Updates the base time in the row key. @param timestamp The timestamp from which to derive the new base time. @return The updated base time.

(final long timestamp)

Source from the content-addressed store, hash-verified

243 * @return The updated base time.
244 */
245 private long updateBaseTime(final long timestamp) {
246 // We force the starting timestamp to be on a MAX_TIMESPAN boundary
247 // so that all TSDs create rows with the same base time. Otherwise
248 // we'd need to coordinate TSDs to avoid creating rows that cover
249 // overlapping time periods.
250 final long base_time = timestamp - (timestamp % Const.MAX_TIMESPAN);
251 // Clone the row key since we're going to change it. We must clone it
252 // because the HBase client may still hold a reference to it in its
253 // internal datastructures.
254 row = Arrays.copyOf(row, row.length);
255 Bytes.setInt(row, (int) base_time, Const.SALT_WIDTH() + tsdb.metrics.width());
256 RowKey.prefixKeyWithSalt(row); // in case the timestamp will be involved in
257 // salting later
258 tsdb.scheduleForCompaction(row, (int) base_time);
259 return base_time;
260 }
261
262 /**
263 * Implements {@link #addPoint} by storing a value with a specific flag.

Callers 1

callMethod · 0.80

Calls 4

SALT_WIDTHMethod · 0.95
prefixKeyWithSaltMethod · 0.95
scheduleForCompactionMethod · 0.80
widthMethod · 0.65

Tested by

no test coverage detected