Add "repack" command to tdbtool.
authorIra Cooper <ira@wakeful.net>
Fri, 6 Jan 2012 23:45:06 +0000 (15:45 -0800)
committerJeremy Allison <jra@samba.org>
Sat, 7 Jan 2012 01:18:40 +0000 (02:18 +0100)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Jan  7 02:18:41 CET 2012 on sn-devel-104

docs-xml/manpages-3/tdbtool.8.xml
lib/tdb/tools/tdbtool.c

index 9f96db277dbbec46f0e9ebc3ea9a2ff66b62c810..51fc540fc9e51b387e4749150a528582ba2b003b 100644 (file)
                </para></listitem>
                </varlistentry>
 
+               <varlistentry>
+               <term>
+               <option>repack</option>
+               </term>
+               <listitem><para>Repack a database using a temporary file to remove fragmentation.
+               </para></listitem>
+               </varlistentry>
+
                <varlistentry>
                <term>
                <option>quit</option>
 
 <refsect1>
        <title>VERSION</title>
-       <para>This man page is correct for version 3.0.25 of the Samba suite.</para>
+       <para>This man page is correct for version 3.6 of the Samba suite.</para>
 </refsect1>
 
 <refsect1>
index d93f742d1c2cfc14db886d6ff992e914d592e541..dc5747f87aa1634bdb20d9d9d79d0e476a151f55 100644 (file)
@@ -61,6 +61,7 @@ enum commands {
        CMD_NEXT,
        CMD_SYSTEM,
        CMD_CHECK,
+       CMD_REPACK,
        CMD_QUIT,
        CMD_HELP
 };
@@ -98,6 +99,7 @@ COMMAND_TABLE cmd_table[] = {
        {"quit",        CMD_QUIT},
        {"q",           CMD_QUIT},
        {"!",           CMD_SYSTEM},
+       {"repack",      CMD_REPACK},
        {NULL,          CMD_HELP}
 };
 
@@ -203,6 +205,7 @@ static void help(void)
 "  list                 : print the database hash table and freelist\n"
 "  free                 : print the database freelist\n"
 "  check                : check the integrity of an opened database\n"
+"  repack               : repack the database\n"
 "  speed                : perform speed tests on the database\n"
 "  ! command            : execute system command\n"
 "  1 | first            : print the first record\n"
@@ -608,6 +611,10 @@ static int do_command(void)
                        bIterate = 0;
                        tdb_transaction_commit(tdb);
                        return 0;
+               case CMD_REPACK:
+                       bIterate = 0;
+                       tdb_repack(tdb);
+                       return 0;
                case CMD_TRANSACTION_CANCEL:
                        bIterate = 0;
                        tdb_transaction_cancel(tdb);