MongoDB2.2 的 Time To Live (TTL) 集合一些注意事项
来源:互联网 发布:dota2 娜迦海妖 知乎 编辑:程序博客网 时间:2024/06/05 06:24
ttl是2.2版本引入的一个新特性,但是在今天的测试过程中,发现秒级别的删除没有正确删除。执行如下:
> use test1switched to db test1> db.ttl.ensureIndex({"Date":1},{expireAfterSeconds:10})> db.ttl.insert({"Date":new Date});> var startDate = new Date();> while(true) {... var count = db.ttl.count();... print("Docs: "+ count + "("+ (new Date() - startDate) + " ms)");... if(count == 0)... break;... sleep(4000);... }Docs: 1(545 ms)Docs: 1(4545 ms)Docs: 1(8546 ms)Docs: 1(12548 ms)Docs: 1(16549 ms)Docs: 1(20551 ms)Docs: 1(24552 ms)Docs: 1(28553 ms)Docs: 1(32555 ms)Docs: 1(36556 ms)Docs: 1(40557 ms)Docs: 1(44574 ms)Docs: 1(48576 ms)Docs: 1(52577 ms)Docs: 1(56578 ms)Docs: 1(60580 ms)Docs: 0(64591 ms)
源码中找到原因是有60s的sleep。
virtual void run() { Client::initThread( name().c_str() ); while ( ! inShutdown() ) { sleepsecs( 60 ); LOG(3) << "TTLMonitor thread awake" << endl; if ( lockedForWriting() ) { // note: this is not perfect as you can go into fsync+lock between // this and actually doing the delete later LOG(3) << " locked for writing" << endl; continue; }
- MongoDB2.2 的 Time To Live (TTL) 集合一些注意事项
- MongoDB 2.2 的 Time To Live (TTL) 集合
- MongoDB 2.2 的 Time To Live (TTL) 集合
- Time to live (TTL)
- TTL time to live
- IP协议里的Time To Live(TTL)
- 生存时间TTL(time to live)
- TTL(time to live)生存时间
- IP协议包中的TTL(Time-To-Live)
- RabbitMQ之TTL(Time-To-Live 过期时间)
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第十五节 设置本机默认的生存时间(time-to-live:TTL)值
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第十五节 设置本机默认的生存时间(time-to-live:TTL)值
- Time to live exceeded
- SPOJ 9126 Time to live
- Spring Data Redis(Repositories-Time To Live)
- MSL(Max Segment Lifetime) TTL(Time to Life) RTT(Round-Trip Time)
- mongodb2.0的改进
- java集合框架中List的定义以及一些注意事项
- MIPS处理器下浮点指令的处理方法
- Shell - Some useful tips to work with Shell
- 第5章 数组 上机实验(2) 利用二维数组学生平均分计算以及课程平均分计算
- Hadoop学习全程记录——在Eclipse中运行第一个MapReduce程序
- Android 横竖屏切换不重新加载
- MongoDB2.2 的 Time To Live (TTL) 集合一些注意事项
- VS2008 f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/dlgdata.cpp 错误调试
- 字节对齐详解
- node.js 调试注意项
- rabbitmq消息件在idc机房监控中的应用
- raw input requires a resolution.
- java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
- 二分查找求上、下界
- 如何在VC8編譯libdecodeqr? (C/C++) (VC++) (Image Processing)