Definition定义
clearJumboFlagClears the jumbo flag for a chunk. To use the command, issue the清除大块的jumbo标志。要使用该命令,请在clearJumboFlagcommand on amongosinstance.mongos实例上发出clearJumboFlag命令。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
Th command has the following syntax:Th命令具有以下语法:
db.adminCommand(
{
clearJumboFlag: "<database>.<collection>",
bounds: <array>
}
)
-OR-
// Cannot use for collections with hashed shard keys
db.adminCommand(
{
clearJumboFlag: "<database>.<collection>",
find: <query>
}
)
Command Fields命令字段
The clearJumboFlag command takes the following fields as arguments:clearJumboFlag命令接受以下字段作为参数:
clearJumboFlag |
| |
bounds |
| |
find |
|
Access Control访问控制
On systems running with 在authorization, the user must have the clearJumboFlag privilege actions on the { db: "", collection: "" } resource.authorization运行的系统上,用户必须对{ db: "", collection: "" } 资源具有clearJumboFlag权限操作。
The built-in role 内置的角色clusterManager provides the appropriate privileges.clusterManager提供了适当的权限。
Example示例
Clear Jumbo Flag for a Chunk (Range-Based Shard Key)清除块的巨型标志(基于范围的分片键)
The sh.status() includes the following sh.status.databases.<collection>.chunk-details for the test.jumbo collection.sh.status()包括以下test.jumbo集合的sh.status.databases.<collection>.chunk-details。
... // Content omitted for brevity
test.jumbo
shard key: { "x" : 1 }
unique: false
balancing: true
chunks:
shardA 2
shardB 2
{ "x" : { "$minKey" : 1 } } -->> { "x" : 1 } on : shardB Timestamp(3, 0)
{ "x" : 1 } -->> { "x" : 2 } on : shardA Timestamp(6, 1) jumbo
{ "x" : 2 } -->> { "x" : 3 } on : shardA Timestamp(5, 1) jumbo
{ "x" : 3 } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(6, 0)
The following 以下clearJumboFlag command specifies the bounds of the { "x" : 1 } -->> { "x" : 2 } chunk:clearJumboFlag命令指定了{ "x" : 1 } -->> { "x" : 2 }块的bounds:
db.adminCommand( {
clearJumboFlag: "test.jumbo",
bounds: [{ "x" : 1 }, { "x" : 2 }]
} )
Upon success, the command returns 成功后,命令在其输出中返回"ok": 1 in its output:"ok": 1:
{
"ok" : 1,
"operationTime" : Timestamp(1580190080, 5),
"$clusterTime" : {
"clusterTime" : Timestamp(1580190080, 5),
"signature" : {
"hash" : BinData(0,"0cYT49s72MHUYV1F2WpoEwlyeVs="),
"keyId" : Long("6786859092951433239")
}
}
}
The following 以下clearJumboFlag command specifies the find field to find the chunk that contains the shard key { "x" : 2 } :clearJumboFlag命令指定find字段以查找包含分片键{ "x" : 2 }的块:
db.adminCommand( {
clearJumboFlag: "test.jumbo",
find: { "x" : 2 }
} )
Upon success, the command returns 成功后,命令在其输出中返回"ok": 1 in its output:"ok": 1:
{
"ok" : 1,
"operationTime" : Timestamp(1580191819, 5),
"$clusterTime" : {
"clusterTime" : Timestamp(1580191819, 5),
"signature" : {
"hash" : BinData(0,"N6x6drN7HUq5MR5ezUJns1rfeqY="),
"keyId" : Long("6786859092951433239")
}
}
}
To verify the operation, run 要验证操作,请再次运行sh.status() again. The jumbo flag should no longer appear in its output.sh.status()。jumbo标志不应再出现在其输出中。
... // Content omitted for brevity
test.jumbo
shard key: { "x" : 1 }
unique: false
balancing: true
chunks:
shardA 2
shardB 2
{ "x" : { "$minKey" : 1 } } -->> { "x" : 1 } on : shardB Timestamp(3, 0)
{ "x" : 1 } -->> { "x" : 2 } on : shardA Timestamp(7, 0)
{ "x" : 2 } -->> { "x" : 3 } on : shardA Timestamp(8, 0)
{ "x" : 3 } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(6, 0)Clear Jumbo Flag for a Chunk (Hashed Shard Key)清除块的巨型标志(哈希分片键)
The sh.status() includes the following sh.status.databases.<collection>.chunk-details for the test.jumboHashed collection. sh.status()包括以下test.jumboHashed集合sh.status.databases.<collection>.chunk-details。The collection uses a hashed shard key.该集合使用哈希分片键。
... // Content omitted for brevity
test.jumboHashed
shard key: { "x" : "hashed" }
unique: false
balancing: true
chunks:
shardA 2
shardB 2
{ "x" : { "$minKey" : 1 } } -->> { "x" : Long(0) } on : shardA Timestamp(1, 0)
{ "x" : Long(0) } -->> { "x" : Long("848411777775835583") } on : shardA Timestamp(4, 0)
{ "x" : Long("848411777775835583") } -->> { "x" : Long("5902408780260971510") } on : shardB Timestamp(4, 1) jumbo
{ "x" : Long("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)
To clear the 如果集合使用哈希分片键,要清除块的jumbo flag for a chunk if the collection uses a hashed shard key, use clearJumboFlag with the bounds field:jumbo标志,请在bounds字段中使用clearJumboFlag:
db.adminCommand( {
clearJumboFlag: "test.jumboHashed",
bounds: [{ "x" : Long("848411777775835583") }, { "x" : Long("5902408780260971510") }]
} )
Upon success, the command returns 成功后,命令在其输出中返回"ok": 1 in its output:"ok": 1:
{
"ok" : 1,
"operationTime" : Timestamp(1580194290, 5),
"$clusterTime" : {
"clusterTime" : Timestamp(1580194290, 5),
"signature" : {
"hash" : BinData(0,"nWCqOYVrab7NEGHWoo2NYENqHR4="),
"keyId" : Long("6786875525496307742")
}
}
}
To verify the operation, run 要验证操作,请再次运行sh.status() again. The jumbo flag should no longer appear in its output.sh.status()。jumbo标志不应再出现在其输出中。
... // Content omitted for brevity
test.jumboHashed
shard key: { "x" : "hashed" }
unique: false
balancing: true
chunks:
shardA 2
shardB 2
{ "x" : { "$minKey" : 1 } } -->> { "x" : Long(0) } on : shardA Timestamp(1, 0)
{ "x" : Long(0) } -->> { "x" : Long("848411777775835583") } on : shardA Timestamp(4, 0)
{ "x" : Long("848411777775835583") } -->> { "x" : Long("5902408780260971510") } on : shardB Timestamp(5, 0)
{ "x" : Long("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)