Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
a235a88c
I
Iotdb
项目概览
apache
/
Iotdb
12 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a235a88c
编写于
1月 21, 2022
作者:
J
Jackie Tien
提交者:
GitHub
1月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IOTDB-2457] Fix Write is blocked after set time_index_level=FILE_TIM… (#4935)
上级
09a46f34
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
188 addition
and
7 deletion
+188
-7
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
...g/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+9
-2
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/TimeIndexLevel.java
...otdb/db/engine/storagegroup/timeindex/TimeIndexLevel.java
+8
-3
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/V012FileTimeIndex.java
...b/db/engine/storagegroup/timeindex/V012FileTimeIndex.java
+169
-0
server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionUtilsTest.java
...pache/iotdb/db/engine/compaction/CompactionUtilsTest.java
+2
-2
未找到文件。
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
浏览文件 @
a235a88c
...
@@ -92,7 +92,7 @@ public class TsFileResource {
...
@@ -92,7 +92,7 @@ public class TsFileResource {
/** time index */
/** time index */
protected
ITimeIndex
timeIndex
;
protected
ITimeIndex
timeIndex
;
/** time index type,
fileTimeIndex = 0, deviceTimeIndex = 1
*/
/** time index type,
V012FileTimeIndex = 0, deviceTimeIndex = 1, fileTimeIndex = 2
*/
private
byte
timeIndexType
;
private
byte
timeIndexType
;
private
ModificationFile
modFile
;
private
ModificationFile
modFile
;
...
@@ -271,6 +271,13 @@ public class TsFileResource {
...
@@ -271,6 +271,13 @@ public class TsFileResource {
}
}
}
}
}
}
// upgrade from v0.12 to v0.13, we need to rewrite the TsFileResource if the previous time index
// is file time index
if
(
timeIndexType
==
0
)
{
timeIndexType
=
2
;
serialize
();
}
}
}
/** deserialize tsfile resource from old file */
/** deserialize tsfile resource from old file */
...
@@ -954,7 +961,7 @@ public class TsFileResource {
...
@@ -954,7 +961,7 @@ public class TsFileResource {
long
endTime
=
timeIndex
.
getMaxEndTime
();
long
endTime
=
timeIndex
.
getMaxEndTime
();
// replace the DeviceTimeIndex with FileTimeIndex
// replace the DeviceTimeIndex with FileTimeIndex
timeIndex
=
new
FileTimeIndex
(
startTime
,
endTime
);
timeIndex
=
new
FileTimeIndex
(
startTime
,
endTime
);
timeIndexType
=
0
;
timeIndexType
=
2
;
return
ramSize
-
timeIndex
.
calculateRamSize
();
return
ramSize
-
timeIndex
.
calculateRamSize
();
}
}
...
...
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/TimeIndexLevel.java
浏览文件 @
a235a88c
...
@@ -20,14 +20,19 @@
...
@@ -20,14 +20,19 @@
package
org.apache.iotdb.db.engine.storagegroup.timeindex
;
package
org.apache.iotdb.db.engine.storagegroup.timeindex
;
public
enum
TimeIndexLevel
{
public
enum
TimeIndexLevel
{
/** file to time index (small memory foot print) */
/**
v0.12
file to time index (small memory foot print) */
FILE_TIME_INDEX
,
V012_
FILE_TIME_INDEX
,
/** device to time index (large memory foot print) */
/** device to time index (large memory foot print) */
DEVICE_TIME_INDEX
;
DEVICE_TIME_INDEX
,
/** file to time index (small memory foot print) */
FILE_TIME_INDEX
;
public
ITimeIndex
getTimeIndex
()
{
public
ITimeIndex
getTimeIndex
()
{
switch
(
this
)
{
switch
(
this
)
{
case
V012_FILE_TIME_INDEX:
return
new
V012FileTimeIndex
();
case
FILE_TIME_INDEX:
case
FILE_TIME_INDEX:
return
new
FileTimeIndex
();
return
new
FileTimeIndex
();
case
DEVICE_TIME_INDEX:
case
DEVICE_TIME_INDEX:
...
...
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/V012FileTimeIndex.java
0 → 100644
浏览文件 @
a235a88c
/*
* 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.timeindex
;
import
org.apache.iotdb.db.exception.PartitionViolationException
;
import
org.apache.iotdb.db.utils.SerializeUtils
;
import
org.apache.iotdb.tsfile.utils.ReadWriteIOUtils
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.ByteBuffer
;
import
java.util.Set
;
public
class
V012FileTimeIndex
implements
ITimeIndex
{
/** devices */
public
V012FileTimeIndex
()
{}
@Override
public
void
serialize
(
OutputStream
outputStream
)
throws
IOException
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and serialize() method should not be called any more."
);
}
@Override
public
FileTimeIndex
deserialize
(
InputStream
inputStream
)
throws
IOException
{
int
size
=
ReadWriteIOUtils
.
readInt
(
inputStream
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
ReadWriteIOUtils
.
readString
(
inputStream
);
}
return
new
FileTimeIndex
(
ReadWriteIOUtils
.
readLong
(
inputStream
),
ReadWriteIOUtils
.
readLong
(
inputStream
));
}
@Override
public
FileTimeIndex
deserialize
(
ByteBuffer
buffer
)
{
int
size
=
buffer
.
getInt
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
SerializeUtils
.
deserializeString
(
buffer
);
}
return
new
FileTimeIndex
(
buffer
.
getLong
(),
buffer
.
getLong
());
}
@Override
public
void
close
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and close() method should not be called any more."
);
}
@Override
public
Set
<
String
>
getDevices
(
String
tsFilePath
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getDevices() method should not be called any more."
);
}
@Override
public
boolean
endTimeEmpty
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and endTimeEmpty() method should not be called any more."
);
}
@Override
public
boolean
stillLives
(
long
timeLowerBound
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and stillLives() method should not be called any more."
);
}
@Override
public
long
calculateRamSize
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and calculateRamSize() method should not be called any more."
);
}
@Override
public
long
getTimePartition
(
String
tsFilePath
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getTimePartition() method should not be called any more."
);
}
@Override
public
long
getTimePartitionWithCheck
(
String
tsFilePath
)
throws
PartitionViolationException
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getTimePartitionWithCheck() method should not be called any more."
);
}
@Override
public
boolean
isSpanMultiTimePartitions
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and isSpanMultiTimePartitions() method should not be called any more."
);
}
@Override
public
void
updateStartTime
(
String
deviceId
,
long
time
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and updateStartTime() method should not be called any more."
);
}
@Override
public
void
updateEndTime
(
String
deviceId
,
long
time
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and updateEndTime() method should not be called any more."
);
}
@Override
public
void
putStartTime
(
String
deviceId
,
long
time
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and putStartTime() method should not be called any more."
);
}
@Override
public
void
putEndTime
(
String
deviceId
,
long
time
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and putEndTime() method should not be called any more."
);
}
@Override
public
long
getStartTime
(
String
deviceId
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getStartTime() method should not be called any more."
);
}
@Override
public
long
getEndTime
(
String
deviceId
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getEndTime() method should not be called any more."
);
}
@Override
public
boolean
checkDeviceIdExist
(
String
deviceId
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and checkDeviceIdExist() method should not be called any more."
);
}
@Override
public
long
getMinStartTime
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getMinStartTime() method should not be called any more."
);
}
@Override
public
long
getMaxEndTime
()
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading and getMaxEndTime() method should not be called any more."
);
}
@Override
public
int
compareDegradePriority
(
ITimeIndex
timeIndex
)
{
throw
new
UnsupportedOperationException
(
"V012FileTimeIndex should be rewritten while upgrading."
);
}
}
server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionUtilsTest.java
浏览文件 @
a235a88c
...
@@ -3205,10 +3205,10 @@ public class CompactionUtilsTest extends AbstractCompactionTest {
...
@@ -3205,10 +3205,10 @@ public class CompactionUtilsTest extends AbstractCompactionTest {
generateModsFile
(
seriesPaths
,
unseqResources
,
Long
.
MIN_VALUE
,
Long
.
MAX_VALUE
);
generateModsFile
(
seriesPaths
,
unseqResources
,
Long
.
MIN_VALUE
,
Long
.
MAX_VALUE
);
for
(
TsFileResource
resource
:
seqResources
)
{
for
(
TsFileResource
resource
:
seqResources
)
{
resource
.
setTimeIndexType
((
byte
)
0
);
resource
.
setTimeIndexType
((
byte
)
2
);
}
}
for
(
TsFileResource
resource
:
unseqResources
)
{
for
(
TsFileResource
resource
:
unseqResources
)
{
resource
.
setTimeIndexType
((
byte
)
0
);
resource
.
setTimeIndexType
((
byte
)
2
);
}
}
for
(
int
i
=
TsFileGeneratorUtils
.
getAlignDeviceOffset
();
for
(
int
i
=
TsFileGeneratorUtils
.
getAlignDeviceOffset
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录