From 819b5303dab1810e25f83ef874b6bc2df7681d3e Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 28 Sep 2000 04:09:13 +0000 Subject: [PATCH] Add txn_checkpoint()'ing disable moddn/newSuperior (needs re'IDing) --- servers/slapd/back-bdb/add.c | 6 ++++++ servers/slapd/back-bdb/back-bdb.h | 4 ++++ servers/slapd/back-bdb/config.c | 13 +++++++++++++ servers/slapd/back-bdb/delete.c | 6 ++++++ servers/slapd/back-bdb/modify.c | 6 ++++++ servers/slapd/back-bdb/modrdn.c | 12 ++++++++++++ servers/slapd/back-bdb/passwd.c | 1 - 7 files changed, 47 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 03aba133d7..346c032f10 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -275,6 +275,12 @@ return_results: send_ldap_result( conn, op, rc, NULL, text, NULL, NULL ); + if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) { + ldap_pvt_thread_yield(); + txn_checkpoint( bdb->bi_dbenv, + bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 ); + } + done: if (p != NULL) { /* free parent and writer lock */ diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index dee9b15684..1a80525c2c 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -69,6 +69,10 @@ struct bdb_info { int bi_ndatabases; struct bdb_db_info **bi_databases; + + int bi_txn_cp; + u_int32_t bi_txn_cp_min; + u_int32_t bi_txn_cp_kbyte; }; #define bi_nextid bi_databases[BDB_NEXTID] #define bi_id2entry bi_databases[BDB_ID2ENTRY] diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index b1bf856a97..f56b8cc2a8 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -42,6 +42,19 @@ bdb_db_config( } bdb->bi_dbenv_home = ch_strdup( argv[1] ); + + /* mode with which to create new database files */ + } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) { + if ( argc < 3 ) { + fprintf( stderr, "%s: line %d: " + "missing parameters in \"checkpoint \" line\n", + fname, lineno ); + return 1; + } + bdb->bi_txn_cp = 1; + bdb->bi_txn_cp_kbyte = strtol( argv[1], NULL, 0 ); + bdb->bi_txn_cp_min = strtol( argv[2], NULL, 0 ); + /* mode with which to create new database files */ } else if ( strcasecmp( argv[0], "mode" ) == 0 ) { if ( argc < 2 ) { diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index b069107384..8ad2557473 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -269,6 +269,12 @@ return_results: send_ldap_result( conn, op, LDAP_SUCCESS, NULL, text, NULL, NULL ); + if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) { + ldap_pvt_thread_yield(); + txn_checkpoint( bdb->bi_dbenv, + bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 ); + } + done: /* free entry */ if( e != NULL ) { diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 100fb8ebb4..6fcba55305 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -307,6 +307,12 @@ return_results: send_ldap_result( conn, op, rc, NULL, text, NULL, NULL ); + if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) { + ldap_pvt_thread_yield(); + txn_checkpoint( bdb->bi_dbenv, + bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 ); + } + done: if( ltid != NULL ) { txn_abort( ltid ); diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 085bed9ac9..3be0b2b221 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -60,6 +60,12 @@ bdb_modrdn( Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn(%s,%s,%s)\n", dn, newrdn, (newSuperior ? newSuperior : "NULL") ); + if( newSuperior != NULL ) { + rc = LDAP_UNWILLING_TO_PERFORM; + text = "newSuperior not implemented (yet)"; + goto return_results; + } + if (0) { /* transaction retry */ retry: rc = txn_abort( ltid ); @@ -515,6 +521,12 @@ return_results: send_ldap_result( conn, op, rc, NULL, text, NULL, NULL ); + if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) { + ldap_pvt_thread_yield(); + txn_checkpoint( bdb->bi_dbenv, + bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 ); + } + done: if( new_dn != NULL ) free( new_dn ); if( new_ndn != NULL ) free( new_ndn ); diff --git a/servers/slapd/back-bdb/passwd.c b/servers/slapd/back-bdb/passwd.c index fa993077c8..cb6ca711f6 100644 --- a/servers/slapd/back-bdb/passwd.c +++ b/servers/slapd/back-bdb/passwd.c @@ -192,7 +192,6 @@ retry: /* transaction retry */ } *text = "entry update failed"; rc = LDAP_OTHER; - goto done; } done: -- 2.39.5