commitReshardCollection

On this page本页内容

Definition定义

commitReshardCollection

New in version 5.0.在版本5.0中新增

During a resharding operation, MongoDB does not block writes until the estimated duration to complete the resharding operation is below two seconds.在重新发送操作期间,MongoDB不会阻止写入,直到完成重新发送操作的估计持续时间低于两秒

If the current estimate is above two seconds but the time frame is acceptable to you, you can finish resharding faster. 如果当前的估计值超过两秒,但您可以接受时间范围,则可以更快地完成重新发货。The commitReshardCollection command blocks writes early and forces the resharding operation to complete.commitReshardCollection命令阻止早期写入,并强制重新加载操作完成。

The command has the following syntax:该命令具有以下语法:

{
  commitReshardCollection: "<database>.<collection>"
}

The mongosh provides a wrapper method sh.commitReshardCollection().mongosh提供了一个包装方法sh.commitReshardCollection()

Example示例

Commit a Resharding Operation提交重新分片操作

The following command forces the resharding operation on the sales.orders to block writes and complete:以下命令强制对sales.orders执行重新分片操作以阻止写入并完成:

db.adminCommand({
  commitReshardCollection: "sales.orders"
})
Tip提示
←  cleanupReshardCollectionenableSharding →