File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed
confignode/src/main/java/org/apache/iotdb/confignode/manager
datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema
node-commons/src/main/java/org/apache/iotdb/commons/schema/table Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 2323import org .apache .iotdb .commons .conf .CommonDescriptor ;
2424import org .apache .iotdb .commons .exception .IllegalPathException ;
2525import org .apache .iotdb .commons .path .PartialPath ;
26+ import org .apache .iotdb .commons .utils .CommonDateTimeUtils ;
2627import org .apache .iotdb .commons .utils .PathUtils ;
2728import org .apache .iotdb .confignode .consensus .request .read .ttl .ShowTTLPlan ;
2829import org .apache .iotdb .confignode .consensus .request .write .database .DatabaseSchemaPlan ;
@@ -136,8 +137,12 @@ public int getTTLCount() {
136137 * @return the maximum ttl of the subtree of the corresponding database. return NULL_TTL if the
137138 * TTL is not set or the database does not exist.
138139 */
139- public long getDatabaseMaxTTL (String database ) {
140- return ttlInfo .getDatabaseMaxTTL (database );
140+ public long getDatabaseMaxTTL (final String database ) {
141+ final long ttl = ttlInfo .getDatabaseMaxTTL (database );
142+ return ttl == Long .MAX_VALUE || ttl < 0
143+ ? ttl
144+ : CommonDateTimeUtils .convertMilliTimeWithPrecision (
145+ ttl , CommonDescriptor .getInstance ().getConfig ().getTimestampPrecision ());
141146 }
142147
143148 /** Only used for upgrading from old database-level ttl to device-level ttl. */
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public long getTTLForTree(IDeviceID deviceID) {
8787
8888 public long getTTLForTable (final String database , final String table ) {
8989 final TsTable tsTable = DataNodeTableCache .getInstance ().getTable (database , table );
90- return tsTable == null ? Long .MAX_VALUE : tsTable .getTableTTL ();
90+ return tsTable == null ? Long .MAX_VALUE : tsTable .getCachedTableTTL ();
9191 }
9292
9393 /** Get ttl with time precision conversion. */
Original file line number Diff line number Diff line change @@ -209,23 +209,20 @@ public List<TsTableColumnSchema> getColumnList() {
209209
210210 // This shall only be called on DataNode, where the tsTable is replaced completely thus an old
211211 // cache won't pollute the newest value
212- public long getTableTTL () {
212+ public long getCachedTableTTL () {
213213 // Cache for performance
214214 if (ttlValue < 0 ) {
215- final long ttl = getTableTTLInMS ();
216- ttlValue =
217- ttl == Long .MAX_VALUE
218- ? ttl
219- : CommonDateTimeUtils .convertMilliTimeWithPrecision (
220- ttl , CommonDescriptor .getInstance ().getConfig ().getTimestampPrecision ());
215+ ttlValue = getTableTTL ();
221216 }
222217 return ttlValue ;
223218 }
224219
225- private long getTableTTLInMS () {
220+ public long getTableTTL () {
226221 final Optional <String > ttl = getPropValue (TTL_PROPERTY );
227222 return ttl .isPresent () && !ttl .get ().equalsIgnoreCase (TTL_INFINITE )
228- ? Long .parseLong (ttl .get ())
223+ ? CommonDateTimeUtils .convertMilliTimeWithPrecision (
224+ Long .parseLong (ttl .get ()),
225+ CommonDescriptor .getInstance ().getConfig ().getTimestampPrecision ())
229226 : Long .MAX_VALUE ;
230227 }
231228
You can’t perform that action at this time.
0 commit comments