1 /* close.c - close bdb2 backend database */
11 #include "back-bdb2.h"
14 bdb2i_back_db_close_internal( BackendDB *be )
16 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
19 /* since close will probably write the NEXTID file,
20 wee need transaction control */
21 if ( bdb2i_enter_backend_w( &lock ) != 0 ) {
25 if ( li->li_nextid != NOID ) {
26 Debug( LDAP_DEBUG_TRACE, "bdb2 backend saving nextid\n", 0, 0, 0 );
27 if ( bdb2i_next_id_save( be ) < 0 ) {
28 Debug( LDAP_DEBUG_ANY, "bdb2 backend nextid save failed!\n",
33 /* before closing all files, leave the backend (thus commiting
34 all writes) and set a last checkpoint */
35 (void) bdb2i_leave_backend_w( lock );
36 (void) bdb2i_set_txn_checkpoint( bdb2i_dbEnv.tx_info, 1 );
38 /* close all DB files */
39 Debug( LDAP_DEBUG_TRACE, "bdb2 backend closing DB files\n", 0, 0, 0 );
40 bdb2i_txn_close_files( be );
41 Debug( LDAP_DEBUG_TRACE, "bdb2 backend done closing DB files\n", 0, 0, 0 );
48 bdb2_back_db_close( BackendDB *be )
53 bdb2i_start_timing( be->bd_info, &time1 );
55 ret = bdb2i_back_db_close_internal( be );
57 bdb2i_stop_timing( be->bd_info, time1, "CLOSE", NULL, NULL );