Flushes the whole server data set. */
| 626 | |
| 627 | /* Flushes the whole server data set. */ |
| 628 | void flushAllDataAndResetRDB(int flags) { |
| 629 | server.dirty += emptyDb(-1,flags,NULL); |
| 630 | if (server.child_type == CHILD_TYPE_RDB) killRDBChild(); |
| 631 | if (server.saveparamslen > 0) { |
| 632 | /* Normally rdbSave() will reset dirty, but we don't want this here |
| 633 | * as otherwise FLUSHALL will not be replicated nor put into the AOF. */ |
| 634 | int saved_dirty = server.dirty; |
| 635 | rdbSaveInfo rsi, *rsiptr; |
| 636 | rsiptr = rdbPopulateSaveInfo(&rsi); |
| 637 | rdbSave(server.rdb_filename,rsiptr); |
| 638 | server.dirty = saved_dirty; |
| 639 | } |
| 640 | |
| 641 | /* Without that extra dirty++, when db was already empty, FLUSHALL will |
| 642 | * not be replicated nor put into the AOF. */ |
| 643 | server.dirty++; |
| 644 | #if defined(USE_JEMALLOC) |
| 645 | /* jemalloc 5 doesn't release pages back to the OS when there's no traffic. |
| 646 | * for large databases, flushdb blocks for long anyway, so a bit more won't |
| 647 | * harm and this way the flush and purge will be synchroneus. */ |
| 648 | if (!(flags & EMPTYDB_ASYNC)) |
| 649 | jemalloc_purge(); |
| 650 | #endif |
| 651 | } |
| 652 | |
| 653 | /* FLUSHDB [ASYNC] |
| 654 | * |
no test coverage detected