From 8a17cd810fa6cbe7b11139ff0f6f24e7bacd318b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 13 Jul 2009 17:04:29 +0200 Subject: Make gencache more stable This provides a compromise between stability and performance: gencache is a persistent database these days that for performance reasons can not use tdb transactions for all writes. This patch splits up gencache into gencache.tdb and gencache_notrans.tdb. gencache_notrans is used with CLEAR_IF_FIRST, writes to it don't use transactions. By default every 5 minutes and when a program exits, all entries from _notrans.tdb are transferred to gencache.tdb in one transaction. --- source3/utils/net.c | 2 ++ source3/utils/net_cache.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'source3/utils') diff --git a/source3/utils/net.c b/source3/utils/net.c index 0e3946f5a5..9f29ac42fe 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -762,6 +762,8 @@ static struct functable net_func[] = { DEBUG(2,("return code = %d\n", rc)); + gencache_stabilize(); + libnetapi_free(c->netapi_ctx); poptFreeContext(pc); diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c index 74d8d29b4b..36cd12fb82 100644 --- a/source3/utils/net_cache.c +++ b/source3/utils/net_cache.c @@ -297,6 +297,21 @@ static int net_cache_flush(struct net_context *c, int argc, const char **argv) return 0; } +static int net_cache_stabilize(struct net_context *c, int argc, + const char **argv) +{ + if (c->display_usage) { + d_printf("Usage:\n" + "net cache flush\n" + " Delete all cache entries.\n"); + return 0; + } + + if (!gencache_stabilize()) { + return -1; + } + return 0; +} /** * Entry point to 'net cache' subfunctionality * @@ -362,6 +377,14 @@ int net_cache(struct net_context *c, int argc, const char **argv) "net cache flush\n" " Delete all cache entries" }, + { + "stabilize", + net_cache_stabilize, + NET_TRANSPORT_LOCAL, + "Move transient cache content to stable storage", + "net cache stabilize\n" + " Move transient cache content to stable storage" + }, {NULL, NULL, 0, NULL, NULL} }; -- cgit