1 /* close.c - close bdb2 backend database */
10 #include "back-bdb2.h"
13 bdb2i_back_db_close_internal( BackendDB *be )
17 /* since close will probably write the NEXTID file,
18 wee need transaction control */
19 if ( bdb2i_enter_backend_w( &lock ) != 0 ) {
23 if ( slapMode != SLAP_TOOL_MODE ) {
25 Debug( LDAP_DEBUG_TRACE, "bdb2 backend saving nextid\n", 0, 0, 0 );
26 if ( bdb2i_next_id_save( be ) < 0 ) {
27 Debug( LDAP_DEBUG_ANY, "bdb2 backend nextid save failed!\n",
32 /* before closing all files, leave the backend (thus commiting
33 all writes) and set a last checkpoint */
34 (void) bdb2i_leave_backend_w( lock );
35 (void) bdb2i_set_txn_checkpoint( bdb2i_dbEnv.tx_info, 1 );
37 /* close all DB files */
38 Debug( LDAP_DEBUG_TRACE, "bdb2 backend closing DB files\n", 0, 0, 0 );
39 bdb2i_txn_close_files( be );
40 Debug( LDAP_DEBUG_TRACE, "bdb2 backend done closing DB files\n", 0, 0, 0 );
47 bdb2_back_db_close( BackendDB *be )
52 bdb2i_start_timing( be->bd_info, &time1 );
54 ret = bdb2i_back_db_close_internal( be );
56 bdb2i_stop_timing( be->bd_info, time1, "CLOSE", NULL, NULL );