You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/09/15 04:51:05 UTC

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1652: [IOTDB-698] add device time index interface

qiaojialin commented on a change in pull request #1652:
URL: https://github.com/apache/incubator-iotdb/pull/1652#discussion_r488380495



##########
File path: server/src/assembly/resources/conf/iotdb-engine.properties
##########
@@ -232,6 +232,11 @@ write_read_free_memory_proportion=6:3:1
 # primitive array size (length of each array) in array pool
 primitive_array_size=128
 
+# device time indexer
+enable_device_indexer=false

Review comment:
       enable_data_file_indexer?

##########
File path: server/src/assembly/resources/conf/iotdb-engine.properties
##########
@@ -232,6 +232,11 @@ write_read_free_memory_proportion=6:3:1
 # primitive array size (length of each array) in array pool
 primitive_array_size=128
 
+# device time indexer
+enable_device_indexer=false
+# 0, indexer base on file; 1, indexer base on rocksdb
+device_indexer_type=0

Review comment:
       data_file_indexer_manager=internal/rocksdb

##########
File path: server/src/main/java/org/apache/iotdb/db/timeIndex/IndexerManager.java
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.timeIndex;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class IndexerManager {

Review comment:
       ```suggestion
   public class FileIndexManager {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/timeIndex/TimeIndex.java
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.timeIndex;
+
+import org.apache.iotdb.db.metadata.PartialPath;
+
+/**
+ * Time Index, like deviceIndexer: [(deviceId, startTime, endTime, TsFilePath)] to accelerate query
+ */
+public class TimeIndex {

Review comment:
       DeviceTimeIndexEntry

##########
File path: server/src/main/java/org/apache/iotdb/db/timeIndex/TimeIndexer.java
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.timeIndex;
+
+import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+
+import java.util.List;
+import java.util.Map;
+
+public interface TimeIndexer {
+  /**
+   * init the Indexer when IoTDB start
+   * @return whether success
+   */
+  public boolean init();
+
+  /**
+   * may do some prepared work before operation
+   * @return whether success
+   */
+  public boolean begin();
+
+  /**
+   * may do some resource release after operation
+   * @return whether success
+   */
+  public boolean end();
+
+  /**
+   * add one index record for the path
+   * @param path
+   * @param startTime
+   * @param endTime
+   * @param tsFilePath
+   * @return
+   */
+  public boolean addIndexForPath(PartialPath path, long startTime, long endTime, String tsFilePath);

Review comment:
       ```suggestion
     public boolean addIndexForFile(PartialPath path, long startTime, long endTime, String tsFilePath);
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/timeIndex/TimeIndexer.java
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.timeIndex;
+
+import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+
+import java.util.List;
+import java.util.Map;
+
+public interface TimeIndexer {

Review comment:
       ```suggestion
   public interface FileIndexer {
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org