|
38 | 38 |
|
39 | 39 | #define UUIDLEN 16
|
40 | 40 |
|
| 41 | +/* LY: This should be different from any error-code in ldap.h, |
| 42 | + * the -42 seems good... */ |
| 43 | +#define SYNC_PAUSED -42 |
| 44 | +#define SYNC_REFRESH_YIELD -421 |
| 45 | + |
41 | 46 | struct nonpresent_entry {
|
42 | 47 | struct berval *npe_name;
|
43 | 48 | struct berval *npe_nname;
|
@@ -763,7 +768,7 @@ do_syncrep_search(
|
763 | 768 |
|
764 | 769 | rc = ldap_sync_search( si, op->o_tmpmemctx );
|
765 | 770 |
|
766 |
| - if( rc != LDAP_SUCCESS ) { |
| 771 | + if ( rc != LDAP_SUCCESS && rc != SYNC_REFRESH_YIELD ) { |
767 | 772 | Debug( LDAP_DEBUG_ANY, "do_syncrep_search: %s "
|
768 | 773 | "ldap_search_ext: %s (%d)\n",
|
769 | 774 | si->si_ridtxt, ldap_err2string( rc ), rc );
|
@@ -848,27 +853,26 @@ compare_csns( struct sync_cookie *sc1, struct sync_cookie *sc2, int *which )
|
848 | 853 | return match;
|
849 | 854 | }
|
850 | 855 |
|
851 |
| -#define SYNC_PAUSED -3 |
852 |
| - |
853 | 856 | static int syncrepl_refresh_begin( syncinfo_t *si ) {
|
854 | 857 | si->si_refreshDone = 0;
|
855 | 858 | quorum_notify_status( si->si_be, si->si_rid, 0 );
|
856 | 859 | if (quorum_syncrepl_gate(si->si_be, si, 1)) {
|
857 |
| - Debug( LDAP_DEBUG_SYNC, "syncrepl_refresh_begin: %s, " |
858 |
| - "yield %ld while busy\n", |
859 |
| - si->si_ridtxt, (long) si->si_interval ); |
860 |
| - return SYNC_PAUSED; |
| 860 | + Debug( LDAP_DEBUG_ANY, "syncrepl_refresh_begin: %s, " |
| 861 | + "yield while busy\n", |
| 862 | + si->si_ridtxt ); |
| 863 | + return SYNC_REFRESH_YIELD; |
861 | 864 | }
|
862 |
| - Debug( LDAP_DEBUG_SYNC, "syncrepl_refresh_begin: %s, success\n", |
| 865 | + Debug( LDAP_DEBUG_ANY, "syncrepl_refresh_begin: %s, success\n", |
863 | 866 | si->si_ridtxt );
|
864 | 867 | return LDAP_SUCCESS;
|
865 | 868 | }
|
866 | 869 |
|
867 | 870 | static void syncrepl_refresh_end( syncinfo_t *si, int rc ) {
|
| 871 | + if (! si->si_refreshDone ) |
| 872 | + Debug( LDAP_DEBUG_ANY, "syncrepl_refresh_end: %s, rc %d\n", |
| 873 | + si->si_ridtxt, rc ); |
868 | 874 | if (rc == LDAP_SUCCESS)
|
869 | 875 | si->si_refreshDone = 1;
|
870 |
| - Debug( LDAP_DEBUG_SYNC, "syncrepl_refresh_end: %s, rc %d\n", |
871 |
| - si->si_ridtxt, rc ); |
872 | 876 | quorum_notify_status( si->si_be, si->si_rid, rc == 0 );
|
873 | 877 | rc = quorum_syncrepl_gate(si->si_be, si, 0);
|
874 | 878 | assert(rc == 0);
|
@@ -1719,7 +1723,7 @@ do_syncrepl(
|
1719 | 1723 |
|
1720 | 1724 | Debug( LDAP_DEBUG_TRACE, "<=do_syncrepl %s, rc %d\n", si->si_ridtxt, rc );
|
1721 | 1725 |
|
1722 |
| - if ( rc != SYNC_PAUSED ) { |
| 1726 | + if ( rc != SYNC_PAUSED && rc != SYNC_REFRESH_YIELD ) { |
1723 | 1727 | if ( abs(si->si_type) == LDAP_SYNC_REFRESH_AND_PERSIST ) {
|
1724 | 1728 | /* If we succeeded, enable the connection for further listening.
|
1725 | 1729 | * If we failed, tear down the connection and reschedule.
|
@@ -1764,6 +1768,13 @@ do_syncrepl(
|
1764 | 1768 | ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
|
1765 | 1769 | rtask->interval.tv_sec = si->si_interval;
|
1766 | 1770 | rc = 0;
|
| 1771 | + } else if ( rc == SYNC_REFRESH_YIELD ) { |
| 1772 | + rtask->interval.tv_sec = 0; |
| 1773 | + rtask->interval.tv_usec = 1000000/10; |
| 1774 | + ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 ); |
| 1775 | + rtask->interval.tv_sec = si->si_interval; |
| 1776 | + rtask->interval.tv_usec = 0; |
| 1777 | + rc = 0; |
1767 | 1778 | } else if ( rc == LDAP_SUCCESS ) {
|
1768 | 1779 | if ( si->si_type == LDAP_SYNC_REFRESH_ONLY ) {
|
1769 | 1780 | defer = 0;
|
|
0 commit comments