Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOTDB-205]Support storage-group-level data ttl #429

Merged
merged 42 commits into from Oct 29, 2019
Merged

[IOTDB-205]Support storage-group-level data ttl #429

merged 42 commits into from Oct 29, 2019

Conversation

jt2594838
Copy link
Contributor

# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/engine/merge/manage/MergeResource.java
#	server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
#	server/src/test/java/org/apache/iotdb/db/engine/cache/DeviceMetaDataCacheTest.java
#	server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java
#	server/src/test/java/org/apache/iotdb/db/query/reader/ReaderTestHelper.java
#	server/src/test/java/org/apache/iotdb/db/query/reader/fileRelated/UnSealedTsFileReaderTest.java
#	server/src/test/java/org/apache/iotdb/db/query/reader/resourceRelated/SeqResourceReaderTest.java
#	server/src/test/java/org/apache/iotdb/db/query/reader/resourceRelated/UnseqResourceReaderTest.java
#	service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java
fix tests
@jt2594838
Copy link
Contributor Author

A design document in CHINESE.
数据定期删除设计文档.docx

@jt2594838
Copy link
Contributor Author

jt2594838 commented Sep 27, 2019

Experiment settings and results. Pay extra attention to the changes in file sizes.
config.properties.txt
iotdb-engine.properties.txt
insertTestWithDefaultPath_IoTDB_TTL_Write11569292133990.xlsx
SERVER_MODE_fit_10_2019_09_24.xlsx

# Conflicts:
#	jdbc/src/main/java/org/apache/iotdb/jdbc/Constant.java
#	jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadata.java
#	jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultSet.java
#	jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
#	server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MGraph.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MetadataOperationType.java
#	server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
#	server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
#	service-rpc/src/main/thrift/rpc.thrift
update comments
fix license
code refinements
@LeiRui
Copy link
Contributor

LeiRui commented Oct 15, 2019

Hi,
This is a review on functionality.
I find the operation unset TTL to <storage group> REALLY requires a seasoned user who knows exactly what he/she is doing. And I totally agree with what you have noted in the guidance:

Notice: When you set TTL to some storage groups, data out of the TTL will be made invisible
immediately, but because the data files may contain both out-dated and living data or the data files may be being used by queries, the physical removal of data is stale. If you increase or unset TTL
just after setting it previously, some previously invisible data may be seen again, but the
physically removed one is lost forever. In other word, different from delete statement, the
atomicity of data deletion is not guaranteed for efficiency concerns.
So we recommend that you do not change the TTL once it is set or at least do not reset it frequently, unless you are determined to suffer the unpredictability.

I want to draw attention to another point that can be easily misunderstood when using the operation unset TTL to <storage group>. That is, the latest insertion time of a storage group, which is the split point used to determine whether the coming data point is sequential or unsequential, will not be “recycled" even if the data before now()-TTL are really deleted.

@jt2594838
Copy link
Contributor Author

That is true. We currently do not provide any way to "recycle" the last flushed time of a device other than DELETE STORAGE GROUP statements, even general DELETE DATA statements can not do that. And the "recycling" does not seem to bring many benefits since, on most occasions, data is rolling forward.

Actually, the data TTL has little relation to the last flushed time. And whether the data goes into sequence files or unsequence files should be invisible to users. I do not think users should be concerned about that.

What I have hidden in my implementation is that "UNSET TTL TO root.group1" equals "SET TTL TO root.group1 Long.maxValue". In all, data TTL just avoids the DBA deleting old data manually.

@LeiRui
Copy link
Contributor

LeiRui commented Oct 16, 2019

And whether the data goes into sequence files or unsequence files should be invisible to users.

I agree.

# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/qp/executor/AbstractQueryProcessExecutor.java
#	server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
#	server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
Copy link
Contributor

@JackieTien97 JackieTien97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lambda used in several places should be replaced by inner class that implements the corresponding functional interface to avoid creating lambda class frequently.

@jt2594838
Copy link
Contributor Author

Creating a new inner class object or creating a lambda does not seem quite different to me. But I hope using method reference could help a bit.

# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
# Conflicts:
#	server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TSLexer.g
#	server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TSParser.g
#	server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
#	server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@fanhualta
Copy link
Contributor

Good job, please fix the conflicts.

# Conflicts:
#	docs/Documentation-CHN/UserGuide/4-Operation Manual/7-IoTDB Query Language.md
#	docs/Documentation/UserGuide/4-Operation Manual/7-IoTDB Query Statement.md
#	server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MGraph.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
#	server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
#	server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
#	server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
#	server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
#	server/src/test/java/org/apache/iotdb/db/metadata/MManagerAdvancedTest.java
#	server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
#	server/src/test/java/org/apache/iotdb/db/metadata/MManagerImproveTest.java
#	server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
# Conflicts:
#	jdbc/src/main/java/org/apache/iotdb/jdbc/Constant.java
#	jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
#	server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
#	server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
#	server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
#	server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
#	server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
#	server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
#	server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
#	server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
static String combineMetadataInStrings(String[] metadatas) {
return MTree.combineMetadataInStrings(metadatas);
static String combineMetadataInStrings(String[] metadataArray) {
return MTree.combineMetadataInStrings(metadataArray);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this method a devil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法是魔鬼吗,这方法干嘛的,连个例子都没有

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你问我我也不知道,我只是当了一下语法警察。

jt2594838 and others added 4 commits October 28, 2019 19:36
# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
#	server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
#	server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
#	server/src/main/java/org/apache/iotdb/db/sync/receiver/SyncServiceImpl.java
@qiaojialin qiaojialin merged commit a89cde6 into master Oct 29, 2019
@qiaojialin qiaojialin deleted the dev_TTL branch October 29, 2019 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants