Flushes the whole server data set. */
| 801 | |
| 802 | /* Flushes the whole server data set. */ |
| 803 | void flushAllDataAndResetRDB(int flags) { |
| 804 | g_pserver->dirty += emptyDb(-1,flags,NULL); |
| 805 | if (g_pserver->FRdbSaveInProgress()) killRDBChild(); |
| 806 | if (g_pserver->saveparamslen > 0) { |
| 807 | /* Normally rdbSave() will reset dirty, but we don't want this here |
| 808 | * as otherwise FLUSHALL will not be replicated nor put into the AOF. */ |
| 809 | int saved_dirty = g_pserver->dirty; |
| 810 | rdbSaveInfo rsi, *rsiptr; |
| 811 | rsiptr = rdbPopulateSaveInfo(&rsi); |
| 812 | rdbSave(nullptr, rsiptr); |
| 813 | g_pserver->dirty = saved_dirty; |
| 814 | } |
| 815 | |
| 816 | /* Without that extra dirty++, when db was already empty, FLUSHALL will |
| 817 | * not be replicated nor put into the AOF. */ |
| 818 | g_pserver->dirty++; |
| 819 | #if defined(USE_JEMALLOC) |
| 820 | /* jemalloc 5 doesn't release pages back to the OS when there's no traffic. |
| 821 | * for large databases, flushdb blocks for long anyway, so a bit more won't |
| 822 | * harm and this way the flush and purge will be synchroneus. */ |
| 823 | if (!(flags & EMPTYDB_ASYNC)) |
| 824 | jemalloc_purge(); |
| 825 | #endif |
| 826 | } |
| 827 | |
| 828 | /* FLUSHDB [ASYNC] |
| 829 | * |
no test coverage detected