diff options
author | Michael Adam <obnox@samba.org> | 2009-02-24 15:40:05 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-02-26 11:05:23 +0100 |
commit | 9f97674ef759c65b874028b7af01fcc65f8dac23 (patch) | |
tree | 6b1ba1742758d80e5dbc332fed3fba06d433b5fe /source3/registry | |
parent | ba0e944c46b5c5e11c2539e15c9fe099a6c39fd1 (diff) | |
download | samba-9f97674ef759c65b874028b7af01fcc65f8dac23.tar.gz samba-9f97674ef759c65b874028b7af01fcc65f8dac23.tar.bz2 samba-9f97674ef759c65b874028b7af01fcc65f8dac23.zip |
s3:registry: wrap deletekey_recursive in one big transaction.
This speeds up "net conf drop" with 2000 shares on my box from
4m40s to 1m50s, leaving virtually only cpu load.
Michael
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_api.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index a5f3935821..4dde493a49 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -1133,18 +1133,54 @@ done: return werr; } +static WERROR reg_deletekey_recursive_trans(TALLOC_CTX *ctx, + struct registry_key *parent, + const char *path, + bool del_key) +{ + WERROR werr; + + werr = regdb_transaction_start(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(0, ("reg_deletekey_recursive_trans: " + "error starting transaction: %s\n", + win_errstr(werr))); + return werr; + } + + werr = reg_deletekey_recursive_internal(ctx, parent, path, del_key); + + if (!W_ERROR_IS_OK(werr)) { + werr = regdb_transaction_cancel(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(0, ("reg_deletekey_recursive_trans: " + "error cancelling transaction: %s\n", + win_errstr(werr))); + } + } else { + werr = regdb_transaction_commit(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(0, ("reg_deletekey_recursive_trans: " + "error committing transaction: %s\n", + win_errstr(werr))); + } + } + + return werr; +} + WERROR reg_deletekey_recursive(TALLOC_CTX *ctx, struct registry_key *parent, const char *path) { - return reg_deletekey_recursive_internal(ctx, parent, path, true); + return reg_deletekey_recursive_trans(ctx, parent, path, true); } WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, struct registry_key *parent, const char *path) { - return reg_deletekey_recursive_internal(ctx, parent, path, false); + return reg_deletekey_recursive_trans(ctx, parent, path, false); } #if 0 |