private long updateBaseTime ( final long timestamp ) { // We force the starting timestamp to be on a MAX_TIMESPAN boundary // so that all TSDs create rows with the same base time. Otherwise // we'd need to coordinate TSDs to avoid creating rows that cover // overlapping time periods. final long base_time = timestamp - ( timestamp % Const . MAX_TIMESPAN ) ; // Clone the row key since we're going to change it. We must clone it // because the HBase client may still hold a reference to it in its // internal datastructures. row = Arrays . copyOf ( row , row . length ) ; Bytes . setInt ( row , ( int ) base_time , Const . SALT_WIDTH ( ) + tsdb . metrics . width ( ) ) ; RowKey . prefixKeyWithSalt ( row ) ; // in case the timestamp will be involved in // salting later tsdb . scheduleForCompaction ( row , ( int ) base_time ) ; return base_time ; }
Updates the base time in the row key .