Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
1e9449bf
I
Iotdb
项目概览
apache
/
Iotdb
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
1e9449bf
编写于
7月 11, 2019
作者:
D
DongFang Mao
提交者:
Jialin Qiao
7月 11, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add UT for DirectoriesStrategy (#197)
* add ut for DirectoriesStrategy
上级
7d566edb
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
254 addition
and
50 deletion
+254
-50
iotdb/pom.xml
iotdb/pom.xml
+19
-0
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategy.java
...iotdb/db/conf/directories/strategy/DirectoryStrategy.java
+16
-15
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/MaxDiskUsableSpaceFirstStrategy.java
...directories/strategy/MaxDiskUsableSpaceFirstStrategy.java
+7
-1
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/MinFolderOccupiedSpaceFirstStrategy.java
...ctories/strategy/MinFolderOccupiedSpaceFirstStrategy.java
+9
-26
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/SequenceStrategy.java
.../iotdb/db/conf/directories/strategy/SequenceStrategy.java
+5
-7
iotdb/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
.../src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
+20
-0
iotdb/src/test/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategyTest.java
...b/db/conf/directories/strategy/DirectoryStrategyTest.java
+177
-0
iotdb/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
...test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+1
-1
未找到文件。
iotdb/pom.xml
浏览文件 @
1e9449bf
...
@@ -70,6 +70,25 @@
...
@@ -70,6 +70,25 @@
<artifactId>
commons-lang3
</artifactId>
<artifactId>
commons-lang3
</artifactId>
<version>
${common.lang3.version}
</version>
<version>
${common.lang3.version}
</version>
</dependency>
</dependency>
<!-- for mocked test-->
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-core
</artifactId>
<version>
2.0.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-module-junit4
</artifactId>
<version>
2.0.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-api-mockito2
</artifactId>
<version>
2.0.2
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategy.java
浏览文件 @
1e9449bf
...
@@ -18,15 +18,17 @@
...
@@ -18,15 +18,17 @@
*/
*/
package
org.apache.iotdb.db.conf.directories.strategy
;
package
org.apache.iotdb.db.conf.directories.strategy
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.utils.CommonUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
/**
/**
* The basic class of all the strategies of multiple directories. If a user wants to define his own
* The basic class of all the strategies of multiple directories. If a user wants to define his own
* strategy, his strategy has to extend this class and implement the abstract method.
* strategy, his strategy has to extend this class and implement the abstract method.
*
* @author East
*/
*/
public
abstract
class
DirectoryStrategy
{
public
abstract
class
DirectoryStrategy
{
...
@@ -39,11 +41,24 @@ public abstract class DirectoryStrategy {
...
@@ -39,11 +41,24 @@ public abstract class DirectoryStrategy {
/**
/**
* To init folders. Do not recommend to overwrite.
* To init folders. Do not recommend to overwrite.
* This method guarantees that at least one folder has available space.
*
*
* @param folders the folders from conf
* @param folders the folders from conf
*/
*/
public
void
init
(
List
<
String
>
folders
)
throws
DiskSpaceInsufficientException
{
public
void
init
(
List
<
String
>
folders
)
throws
DiskSpaceInsufficientException
{
this
.
folders
=
folders
;
this
.
folders
=
folders
;
boolean
hasSpace
=
false
;
for
(
String
folder
:
folders
)
{
if
(
CommonUtils
.
hasSpace
(
folder
))
{
hasSpace
=
true
;
break
;
}
}
if
(!
hasSpace
)
{
throw
new
DiskSpaceInsufficientException
(
String
.
format
(
"All disks of folders %s are full, can't init."
,
folders
));
}
}
}
/**
/**
...
@@ -72,18 +87,4 @@ public abstract class DirectoryStrategy {
...
@@ -72,18 +87,4 @@ public abstract class DirectoryStrategy {
public
void
setFolderForTest
(
String
path
)
{
public
void
setFolderForTest
(
String
path
)
{
folders
.
set
(
0
,
path
);
folders
.
set
(
0
,
path
);
}
}
protected
long
getUsableSpace
(
String
dir
)
{
File
file
=
new
File
(
dir
);
if
(!
file
.
exists
()
&&
!
file
.
mkdirs
())
{
return
0
;
}
long
space
=
file
.
getFreeSpace
();
logger
.
trace
(
"Folder {} has {} available bytes."
,
dir
,
space
);
return
space
;
}
protected
boolean
hasSpace
(
String
dir
)
{
return
getUsableSpace
(
dir
)
>
0
;
}
}
}
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/MaxDiskUsableSpaceFirstStrategy.java
浏览文件 @
1e9449bf
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
package
org.apache.iotdb.db.conf.directories.strategy
;
package
org.apache.iotdb.db.conf.directories.strategy
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.utils.CommonUtils
;
public
class
MaxDiskUsableSpaceFirstStrategy
extends
DirectoryStrategy
{
public
class
MaxDiskUsableSpaceFirstStrategy
extends
DirectoryStrategy
{
...
@@ -35,7 +36,12 @@ public class MaxDiskUsableSpaceFirstStrategy extends DirectoryStrategy {
...
@@ -35,7 +36,12 @@ public class MaxDiskUsableSpaceFirstStrategy extends DirectoryStrategy {
long
maxSpace
=
0
;
long
maxSpace
=
0
;
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
long
space
=
getUsableSpace
(
folders
.
get
(
i
));
String
folder
=
folders
.
get
(
i
);
if
(!
CommonUtils
.
hasSpace
(
folder
))
{
continue
;
}
long
space
=
CommonUtils
.
getUsableSpace
(
folder
);
if
(
space
>
maxSpace
)
{
if
(
space
>
maxSpace
)
{
maxSpace
=
space
;
maxSpace
=
space
;
maxIndex
=
i
;
maxIndex
=
i
;
...
...
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/MinFolderOccupiedSpaceFirstStrategy.java
浏览文件 @
1e9449bf
...
@@ -19,17 +19,11 @@
...
@@ -19,17 +19,11 @@
package
org.apache.iotdb.db.conf.directories.strategy
;
package
org.apache.iotdb.db.conf.directories.strategy
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.stream.Stream
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.utils.CommonUtils
;
public
class
MinFolderOccupiedSpaceFirstStrategy
extends
DirectoryStrategy
{
public
class
MinFolderOccupiedSpaceFirstStrategy
extends
DirectoryStrategy
{
// directory space is measured by MB
private
static
final
long
DATA_SIZE_SHIFT
=
1024L
*
1024
;
@Override
@Override
public
int
nextFolderIndex
()
throws
DiskSpaceInsufficientException
{
public
int
nextFolderIndex
()
throws
DiskSpaceInsufficientException
{
return
getMinOccupiedSpaceFolder
();
return
getMinOccupiedSpaceFolder
();
...
@@ -37,15 +31,20 @@ public class MinFolderOccupiedSpaceFirstStrategy extends DirectoryStrategy {
...
@@ -37,15 +31,20 @@ public class MinFolderOccupiedSpaceFirstStrategy extends DirectoryStrategy {
private
int
getMinOccupiedSpaceFolder
()
throws
DiskSpaceInsufficientException
{
private
int
getMinOccupiedSpaceFolder
()
throws
DiskSpaceInsufficientException
{
int
minIndex
=
-
1
;
int
minIndex
=
-
1
;
long
minSpace
=
Integer
.
MAX_VALUE
;
long
minSpace
=
Long
.
MAX_VALUE
;
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
String
folder
=
folders
.
get
(
i
);
String
folder
=
folders
.
get
(
i
);
if
(!
hasSpace
(
folder
))
{
if
(!
CommonUtils
.
hasSpace
(
folder
))
{
continue
;
continue
;
}
}
long
space
=
getOccupiedSpace
(
folder
);
long
space
=
0
;
try
{
space
=
CommonUtils
.
getOccupiedSpace
(
folder
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"Cannot calculate occupied space for path {}."
,
folder
,
e
);
}
if
(
space
<
minSpace
)
{
if
(
space
<
minSpace
)
{
minSpace
=
space
;
minSpace
=
space
;
minIndex
=
i
;
minIndex
=
i
;
...
@@ -58,20 +57,4 @@ public class MinFolderOccupiedSpaceFirstStrategy extends DirectoryStrategy {
...
@@ -58,20 +57,4 @@ public class MinFolderOccupiedSpaceFirstStrategy extends DirectoryStrategy {
return
minIndex
;
return
minIndex
;
}
}
private
long
getOccupiedSpace
(
String
path
)
{
Path
folder
=
Paths
.
get
(
path
);
long
size
=
Long
.
MAX_VALUE
;
try
{
try
(
Stream
<
Path
>
stream
=
Files
.
walk
(
folder
))
{
size
=
stream
.
filter
(
p
->
p
.
toFile
().
isFile
())
.
mapToLong
(
p
->
p
.
toFile
().
length
())
.
sum
();
}
}
catch
(
IOException
e
)
{
logger
.
error
(
"Cannot calculate occupied space for seriesPath {}."
,
path
,
e
);
}
return
size
/
DATA_SIZE_SHIFT
;
}
}
}
iotdb/src/main/java/org/apache/iotdb/db/conf/directories/strategy/SequenceStrategy.java
浏览文件 @
1e9449bf
...
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.conf.directories.strategy;
...
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.conf.directories.strategy;
import
java.util.List
;
import
java.util.List
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.utils.CommonUtils
;
public
class
SequenceStrategy
extends
DirectoryStrategy
{
public
class
SequenceStrategy
extends
DirectoryStrategy
{
...
@@ -29,18 +30,15 @@ public class SequenceStrategy extends DirectoryStrategy {
...
@@ -29,18 +30,15 @@ public class SequenceStrategy extends DirectoryStrategy {
public
void
init
(
List
<
String
>
folders
)
throws
DiskSpaceInsufficientException
{
public
void
init
(
List
<
String
>
folders
)
throws
DiskSpaceInsufficientException
{
super
.
init
(
folders
);
super
.
init
(
folders
);
// super.init() ensures at least one folder is not full,
// so currentIndex will not be -1 after loop
currentIndex
=
-
1
;
currentIndex
=
-
1
;
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
folders
.
size
();
i
++)
{
if
(
hasSpace
(
folders
.
get
(
i
)))
{
if
(
CommonUtils
.
hasSpace
(
folders
.
get
(
i
)))
{
currentIndex
=
i
;
currentIndex
=
i
;
break
;
break
;
}
}
}
}
if
(
currentIndex
==
-
1
)
{
throw
new
DiskSpaceInsufficientException
(
String
.
format
(
"All disks of folders %s are full, can't init."
,
folders
));
}
}
}
@Override
@Override
...
@@ -53,7 +51,7 @@ public class SequenceStrategy extends DirectoryStrategy {
...
@@ -53,7 +51,7 @@ public class SequenceStrategy extends DirectoryStrategy {
private
int
tryGetNextIndex
(
int
start
)
throws
DiskSpaceInsufficientException
{
private
int
tryGetNextIndex
(
int
start
)
throws
DiskSpaceInsufficientException
{
int
index
=
(
start
+
1
)
%
folders
.
size
();
int
index
=
(
start
+
1
)
%
folders
.
size
();
while
(!
hasSpace
(
folders
.
get
(
index
)))
{
while
(!
CommonUtils
.
hasSpace
(
folders
.
get
(
index
)))
{
index
=
(
index
+
1
)
%
folders
.
size
();
index
=
(
index
+
1
)
%
folders
.
size
();
if
(
index
==
start
)
{
if
(
index
==
start
)
{
throw
new
DiskSpaceInsufficientException
(
folders
);
throw
new
DiskSpaceInsufficientException
(
folders
);
...
...
iotdb/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
浏览文件 @
1e9449bf
...
@@ -18,6 +18,12 @@
...
@@ -18,6 +18,12 @@
*/
*/
package
org.apache.iotdb.db.utils
;
package
org.apache.iotdb.db.utils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
public
class
CommonUtils
{
public
class
CommonUtils
{
private
CommonUtils
(){}
private
CommonUtils
(){}
...
@@ -35,4 +41,18 @@ public class CommonUtils {
...
@@ -35,4 +41,18 @@ public class CommonUtils {
return
Integer
.
parseInt
(
javaVersionElements
[
0
]);
return
Integer
.
parseInt
(
javaVersionElements
[
0
]);
}
}
}
}
public
static
long
getUsableSpace
(
String
dir
)
{
return
new
File
(
dir
).
getFreeSpace
();
}
public
static
boolean
hasSpace
(
String
dir
)
{
return
getUsableSpace
(
dir
)
>
0
;
}
public
static
long
getOccupiedSpace
(
String
folderPath
)
throws
IOException
{
Path
folder
=
Paths
.
get
(
folderPath
);
return
Files
.
walk
(
folder
).
filter
(
p
->
p
.
toFile
().
isFile
())
.
mapToLong
(
p
->
p
.
toFile
().
length
()).
sum
();
}
}
}
iotdb/src/test/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategyTest.java
0 → 100644
浏览文件 @
1e9449bf
/**
* 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.conf.directories.strategy
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
fail
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException
;
import
org.apache.iotdb.db.utils.CommonUtils
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.powermock.api.mockito.PowerMockito
;
import
org.powermock.core.classloader.annotations.PowerMockIgnore
;
import
org.powermock.core.classloader.annotations.PrepareForTest
;
import
org.powermock.modules.junit4.PowerMockRunner
;
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockIgnore
({
"com.sun.org.apache.xerces.*"
,
"javax.xml.*"
,
"org.xml.*"
,
"org.w3c.*"
})
@PrepareForTest
(
CommonUtils
.
class
)
public
class
DirectoryStrategyTest
{
List
<
String
>
dataDirList
;
Set
<
Integer
>
fullDirIndexSet
;
@Before
public
void
setUp
()
throws
DiskSpaceInsufficientException
,
IOException
{
dataDirList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
dataDirList
.
add
(
"data"
+
i
);
}
fullDirIndexSet
=
new
HashSet
<>();
fullDirIndexSet
.
add
(
1
);
fullDirIndexSet
.
add
(
3
);
PowerMockito
.
mockStatic
(
CommonUtils
.
class
);
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
boolean
res
=
!
fullDirIndexSet
.
contains
(
i
);
PowerMockito
.
when
(
CommonUtils
.
hasSpace
(
dataDirList
.
get
(
i
))).
thenReturn
(
res
);
PowerMockito
.
when
(
CommonUtils
.
getUsableSpace
(
dataDirList
.
get
(
i
))).
thenReturn
(
res
?
(
long
)
(
i
+
1
)
:
0L
);
PowerMockito
.
when
(
CommonUtils
.
getOccupiedSpace
(
dataDirList
.
get
(
i
))).
thenReturn
(
res
?
(
long
)
(
i
+
1
)
:
Long
.
MAX_VALUE
);
}
}
@After
public
void
tearDown
()
{
}
@Test
public
void
testSequenceStrategy
()
throws
DiskSpaceInsufficientException
{
SequenceStrategy
sequenceStrategy
=
new
SequenceStrategy
();
sequenceStrategy
.
init
(
dataDirList
);
// loop two times of data dir size to fully loop
int
index
=
0
;
for
(
int
i
=
0
;
i
<
dataDirList
.
size
()
*
2
;
i
++,
index
++)
{
index
=
index
%
dataDirList
.
size
();
while
(
fullDirIndexSet
.
contains
(
index
))
{
index
=
(
index
+
1
)
%
dataDirList
.
size
();
}
assertEquals
(
index
,
sequenceStrategy
.
nextFolderIndex
());
}
}
@Test
public
void
testMaxDiskUsableSpaceFirstStrategy
()
throws
DiskSpaceInsufficientException
{
MaxDiskUsableSpaceFirstStrategy
maxDiskUsableSpaceFirstStrategy
=
new
MaxDiskUsableSpaceFirstStrategy
();
maxDiskUsableSpaceFirstStrategy
.
init
(
dataDirList
);
int
maxIndex
=
getIndexOfMaxSpace
();
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
assertEquals
(
maxIndex
,
maxDiskUsableSpaceFirstStrategy
.
nextFolderIndex
());
}
PowerMockito
.
when
(
CommonUtils
.
getUsableSpace
(
dataDirList
.
get
(
maxIndex
))).
thenReturn
(
0L
);
maxIndex
=
getIndexOfMaxSpace
();
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
assertEquals
(
maxIndex
,
maxDiskUsableSpaceFirstStrategy
.
nextFolderIndex
());
}
}
private
int
getIndexOfMaxSpace
()
{
int
index
=
-
1
;
long
maxSpace
=
-
1
;
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
long
space
=
CommonUtils
.
getUsableSpace
(
dataDirList
.
get
(
i
));
if
(
maxSpace
<
space
)
{
index
=
i
;
maxSpace
=
space
;
}
}
return
index
;
}
@Test
public
void
testMinFolderOccupiedSpaceFirstStrategy
()
throws
DiskSpaceInsufficientException
,
IOException
{
MinFolderOccupiedSpaceFirstStrategy
minFolderOccupiedSpaceFirstStrategy
=
new
MinFolderOccupiedSpaceFirstStrategy
();
minFolderOccupiedSpaceFirstStrategy
.
init
(
dataDirList
);
int
minIndex
=
getIndexOfMinOccupiedSpace
();
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
assertEquals
(
minIndex
,
minFolderOccupiedSpaceFirstStrategy
.
nextFolderIndex
());
}
PowerMockito
.
when
(
CommonUtils
.
getOccupiedSpace
(
dataDirList
.
get
(
minIndex
))).
thenReturn
(
Long
.
MAX_VALUE
);
minIndex
=
getIndexOfMinOccupiedSpace
();
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
assertEquals
(
minIndex
,
minFolderOccupiedSpaceFirstStrategy
.
nextFolderIndex
());
}
}
private
int
getIndexOfMinOccupiedSpace
()
throws
IOException
{
int
index
=
-
1
;
long
minOccupied
=
Long
.
MAX_VALUE
;
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
long
space
=
CommonUtils
.
getOccupiedSpace
(
dataDirList
.
get
(
i
));
if
(
minOccupied
>
space
)
{
index
=
i
;
minOccupied
=
space
;
}
}
return
index
;
}
@Test
public
void
testAllDiskFull
()
{
for
(
int
i
=
0
;
i
<
dataDirList
.
size
();
i
++)
{
PowerMockito
.
when
(
CommonUtils
.
hasSpace
(
dataDirList
.
get
(
i
))).
thenReturn
(
false
);
}
SequenceStrategy
sequenceStrategy
=
new
SequenceStrategy
();
try
{
sequenceStrategy
.
init
(
dataDirList
);
fail
();
}
catch
(
DiskSpaceInsufficientException
e
)
{
}
MaxDiskUsableSpaceFirstStrategy
maxDiskUsableSpaceFirstStrategy
=
new
MaxDiskUsableSpaceFirstStrategy
();
try
{
maxDiskUsableSpaceFirstStrategy
.
init
(
dataDirList
);
fail
();
}
catch
(
DiskSpaceInsufficientException
e
)
{
}
MinFolderOccupiedSpaceFirstStrategy
minFolderOccupiedSpaceFirstStrategy
=
new
MinFolderOccupiedSpaceFirstStrategy
();
try
{
minFolderOccupiedSpaceFirstStrategy
.
init
(
dataDirList
);
fail
();
}
catch
(
DiskSpaceInsufficientException
e
)
{
}
}
}
\ No newline at end of file
iotdb/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
浏览文件 @
1e9449bf
...
@@ -152,7 +152,7 @@ public class EnvironmentUtils {
...
@@ -152,7 +152,7 @@ public class EnvironmentUtils {
}
}
// create unsequential files
// create unsequential files
for
(
String
path
:
directoryManager
.
getAllUnSequenceFileFolders
())
{
for
(
String
path
:
directoryManager
.
getAllUnSequenceFileFolders
())
{
c
lean
Dir
(
path
);
c
reate
Dir
(
path
);
}
}
// create storage group
// create storage group
createDir
(
config
.
getSystemDir
());
createDir
(
config
.
getSystemDir
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录