Support double-buffering for threaded slapadd

This commit is contained in:
Howard Chu 2012-04-14 07:54:26 -07:00
parent 5bbfd85a83
commit 519e2b34b5

View File

@ -331,6 +331,7 @@ slapadd( int argc, char **argv )
struct berval bvtext; struct berval bvtext;
ldap_pvt_thread_t thr; ldap_pvt_thread_t thr;
ID id; ID id;
Entry *prev = NULL;
int ldifrc; int ldifrc;
int rc = EXIT_SUCCESS; int rc = EXIT_SUCCESS;
@ -431,8 +432,11 @@ slapadd( int argc, char **argv )
"(line=%d): %s\n", progname, erec.e->e_dn, "(line=%d): %s\n", progname, erec.e->e_dn,
erec.lineno, bvtext.bv_val ); erec.lineno, bvtext.bv_val );
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
entry_free( erec.e ); if( continuemode ) {
if( continuemode ) continue; if ( prev ) entry_free( prev );
prev = erec.e;
continue;
}
break; break;
} }
if ( verbose ) if ( verbose )
@ -444,7 +448,8 @@ slapadd( int argc, char **argv )
erec.e->e_dn ); erec.e->e_dn );
} }
entry_free( erec.e ); if ( prev ) entry_free( prev );
prev = erec.e;
} }
if ( slap_tool_thread_max > 1 ) { if ( slap_tool_thread_max > 1 ) {
@ -455,6 +460,7 @@ slapadd( int argc, char **argv )
ldap_pvt_thread_mutex_unlock( &add_mutex ); ldap_pvt_thread_mutex_unlock( &add_mutex );
ldap_pvt_thread_join( thr, NULL ); ldap_pvt_thread_join( thr, NULL );
} }
if ( erec.e ) entry_free( erec.e );
if ( ldifrc < 0 ) if ( ldifrc < 0 )
rc = EXIT_FAILURE; rc = EXIT_FAILURE;