From 2adcccb27d564b927bc056a81c059c546c40c725 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Mon, 28 Jun 2004 23:51:17 +0000 Subject: [PATCH] logging psearch return code --- servers/slapd/back-bdb/add.c | 14 ++++++++++-- servers/slapd/back-bdb/delete.c | 13 ++++++++++- servers/slapd/back-bdb/modify.c | 39 ++++++++++++++++++++++++++++++--- servers/slapd/back-bdb/modrdn.c | 39 ++++++++++++++++++++++++++++++--- 4 files changed, 96 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 67a24b73d0..104b289d7a 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -504,8 +504,18 @@ retry: /* transaction retry */ ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); assert( BEI(e) ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch( op, rs, ps_list, e, - LDAP_PSEARCH_BY_ADD ); + rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_ADD ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_add: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_add: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 36ef298003..148230ec01 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -581,7 +581,18 @@ retry: /* transaction retry */ if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) { ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE ); + rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_delete: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_delete: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index b2a14b0228..3c2d47e044 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -542,7 +542,18 @@ retry: /* transaction retry */ if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) { ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); + rc = bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } @@ -691,12 +702,34 @@ retry: /* transaction retry */ /* Loop through in-scope entries for each psearch spec */ ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); + rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } pm_list = LDAP_LIST_FIRST(&op->o_pm_list); while ( pm_list != NULL ) { - bdb_psearch(op, rs, pm_list->ps_op, + rc = bdb_psearch(op, rs, pm_list->ps_op, e, LDAP_PSEARCH_BY_SCOPEOUT); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modify: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } LDAP_LIST_REMOVE ( pm_list, ps_link ); pm_prev = pm_list; pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 11651e0b28..8d29504e7c 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -896,7 +896,18 @@ retry: /* transaction retry */ if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) { ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); + rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } @@ -1041,12 +1052,34 @@ retry: /* transaction retry */ /* Loop through in-scope entries for each psearch spec */ ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { - bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); + rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } } pm_list = LDAP_LIST_FIRST(&op->o_pm_list); while ( pm_list != NULL ) { - bdb_psearch(op, rs, pm_list->ps_op, + rc = bdb_psearch(op, rs, pm_list->ps_op, e, LDAP_PSEARCH_BY_SCOPEOUT); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ERR, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "bdb_modrdn: persistent search failed (%d,%d)\n", + rc, rs->sr_err, 0 ); +#endif + } pm_prev = pm_list; LDAP_LIST_REMOVE ( pm_list, ps_link ); pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); -- 2.39.5