You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/06/16 08:51:28 UTC
[iotdb] branch new_compaction updated: add FakedTsFileResource
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch new_compaction
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/new_compaction by this push:
new 8aa5e69 add FakedTsFileResource
8aa5e69 is described below
commit 8aa5e691959d555e487bc32b6479a14cb8045e32
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Jun 16 16:51:00 2021 +0800
add FakedTsFileResource
---
.../engine/storagegroup/StorageGroupProcessor.java | 2 --
.../db/engine/storagegroup/TsFileResource.java | 17 ++-------
.../engine/storagegroup/FakedTsFileResource.java | 42 ++++++++++++++++++++++
3 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index cf26187..97ad2a6 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -2080,12 +2080,10 @@ public class StorageGroupProcessor {
/** upgrade all files belongs to this storage group */
public void upgrade() {
for (TsFileResource seqTsFileResource : upgradeSeqFileList) {
- seqTsFileResource.setSeq(true);
seqTsFileResource.setUpgradeTsFileResourceCallBack(this::upgradeTsFileResourceCallBack);
seqTsFileResource.doUpgrade();
}
for (TsFileResource unseqTsFileResource : upgradeUnseqFileList) {
- unseqTsFileResource.setSeq(false);
unseqTsFileResource.setUpgradeTsFileResourceCallBack(this::upgradeTsFileResourceCallBack);
unseqTsFileResource.doUpgrade();
}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index 3f0ccbe..c93c324 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -108,9 +108,9 @@ public class TsFileResource {
private ModificationFile modFile;
- private volatile boolean closed = false;
+ protected volatile boolean closed = false;
private volatile boolean deleted = false;
- private volatile boolean isMerging = false;
+ volatile boolean isMerging = false;
private TsFileLock tsFileLock = new TsFileLock();
@@ -140,12 +140,6 @@ public class TsFileResource {
private UpgradeTsFileResourceCallBack upgradeTsFileResourceCallBack;
/**
- * indicate if this tsfile resource belongs to a sequence tsfile or not used for upgrading
- * v0.9.x/v1 -> 0.10/v2
- */
- private boolean isSeq;
-
- /**
* If it is not null, it indicates that the current tsfile resource is a snapshot of the
* originTsFileResource, and if so, when we want to used the lock, we should try to acquire the
* lock of originTsFileResource
@@ -691,13 +685,6 @@ public class TsFileResource {
return upgradedResources;
}
- public void setSeq(boolean isSeq) {
- this.isSeq = isSeq;
- }
-
- public boolean isSeq() {
- return isSeq;
- }
public void setUpgradeTsFileResourceCallBack(
UpgradeTsFileResourceCallBack upgradeTsFileResourceCallBack) {
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FakedTsFileResource.java b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FakedTsFileResource.java
new file mode 100644
index 0000000..d69e4fb
--- /dev/null
+++ b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FakedTsFileResource.java
@@ -0,0 +1,42 @@
+/*
+ * 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.engine.storagegroup;
+
+public class FakedTsFileResource extends TsFileResource {
+
+ private long tsFileSize;
+
+ public FakedTsFileResource(long tsFileSize) {
+ this.tsFileSize = tsFileSize;
+ super.closed = false;
+ super.isMerging = false;
+ }
+
+ public FakedTsFileResource(long tsFileSize, boolean isClosed, boolean isMerging) {
+ this.tsFileSize = tsFileSize;
+ super.closed = isClosed;
+ super.isMerging = isMerging;
+ }
+
+ @Override
+ public long getTsFileSize() {
+ return tsFileSize;
+ }
+
+}