getChunksMeta
语法
getChunksMeta([chunkPath], [top = 1024])
参数
chunkPath 是一个或多个chunk的DFS路径,支持使用通配符 %,* 以及?。
top 是一个整数,表示结果中返回的chunk的最多个数。默认值为1024。若设置 top= -1,则不限制返回的chunk的数量。
详情
返回本地节点上指定数据库chunk的元数据。若不指定chunkPath,返回本地节点上所有数据库chunk的元数据。
返回一个表,包含以下列
site: 节点别名
chunkId: chunk的唯一标识
path: 分区的物理路径
dfsPath: 分区DFS路径
type: 分区类型。0表示file chunk;1表示tablet chunk。
flag: 删除标志。若flag=1,此chunk数据不能被查询到,但尚未从磁盘删除。
size: 表示file chunk占用磁盘空间,单位为byte。对于tablet chunk,返回0,需要使用 getTabletsMeta 函数来查看其占用的磁盘空间。
version: 版本号
state: chunk状态。0表示数据已导入;1表示正在导入数据;2表示正在恢复数据。
versionList: 版本链
resolved: 表示chunk的事务是否处于决议(commit)状态。true表示决议状态,false表示决议后的最终状态。
例子
$ if(existsDatabase("dfs://testDB")){
$ dropDatabase("dfs://testDB")
$ }
$ db=database("dfs://testDB", VALUE, 1..10)
$ n=1000000
$ t=table(rand(1..10, n) as id, rand(100.0, n) as x)
$ n=2000000
$ t=table(rand(1..10, n) as id, rand(100.0, n) as x, rand(100, n) as y)
$ db.createPartitionedTable(t, `pt2, `id).append!(t)
$ getChunksMeta("/testDB%");
site |
chunkId |
path |
dfsPath |
type |
flag |
size |
version |
state |
versionList |
resolved |
---|---|---|---|---|---|---|---|---|---|---|
P2-node1 |
092d5e12-e595-6f9e-b049-83cba1716997 |
/ssd/ssd5/jzVol… |
/testDB/pt2.tbl |
0 |
0 |
49 |
1 |
0 |
2052:49; |
false |
P2-node1 |
d31e6b47-18f0-37a6-0146-45bf6e266c56 |
/ssd/ssd6/jzVol… |
/testDB/7 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |
P2-node1 |
cd99d9ef-d864-f3bc-4945-f97017d43bf1 |
/ssd/ssd5/jzVol… |
/testDB/2 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |
P2-node1 |
8da4bea8-31d0-31b5-784f-67aa6339633d |
/ssd/ssd5/jzVol… |
/testDB/pt1.tbl |
0 |
0 |
41 |
1 |
0 |
2050:41; |
false |
P2-node1 |
dd5fc885-f6a6-bfae-8543-254f9fb92484 |
/ssd/ssd6/jzVol… |
/testDB/10 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |
P2-node1 |
4b8aaed1-2dd6-acb7-5148-4add878c3b33 |
/ssd/ssd6/jzVol… |
/testDB/domain |
0 |
0 |
88 |
1 |
0 |
2049:88; |
false |
P2-node1 |
28cb59ec-185a-0ebf-a849-267e769936af |
/ssd/ssd6/jzVol… |
/testDB/8 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |
P2-node1 |
b2facbd2-e301-428f-f94f-8579023f78af |
/ssd/ssd6/jzVol… |
/testDB/3 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |
P2-node1 |
8bec6445-bc6d-3693-7f46-d1bcdd350182 |
/ssd/ssd6/jzVol… |
/testDB/5 |
1 |
0 |
0 |
2 |
0 |
cid : 2053,pt1… |
false |