赞
踩
// example. always add at least 100 bytes of padding, and at least 10% of the doc size too > db.runCommand( { compact : 'mycollectionname', paddingBytes:100, paddingFactor:1.1 } )
At the beginning of compaction, indexes are dropped for the collection. At the end, indexes are rebuilt. Thus, if you kill the compaction in the middle of its operation, either with killOp or a server failure, indexes may be missing from your collection. If you are running with --journal, no data should ever be lost on a crash during compaction, although on startup the indexes will not be present. (Regardless of this, always do a backup before system maintenance such as this!) When the indexes are rebuilt, they will be in the 2.0 index format.
If there's a crash while the command is running, then as long as journaling is enabled, your data will be safe.
Additionally, if a compaction operation is interrupted, much of the existing free space in a collection may become un-reusable. In this scenario, it is recommended that compaction be run again, to completion, to restore use of this free space
主要说的是索引在执行中,会重建,如果意外终止,会丢失数据,不过如果开启了journal,数据相对来说安全很多,还有就是空闲空间会变成不能重用,需要再次执行compact,恢复空闲空间的使用。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。