@@ -539,6 +539,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
539539 this ->parents [i].name = this ->parents [i].hostname ;
540540 this ->parents [i].available = true ;
541541 this ->parents [i].weight = weight;
542+ this ->parents [i].retriers = 0 ;
542543 if (tmp3) {
543544 memcpy (this ->parents [i].hash_string , tmp3 + 1 , strlen (tmp3));
544545 this ->parents [i].name = this ->parents [i].hash_string ;
@@ -554,6 +555,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
554555 this ->secondary_parents [i].name = this ->secondary_parents [i].hostname ;
555556 this ->secondary_parents [i].available = true ;
556557 this ->secondary_parents [i].weight = weight;
558+ this ->secondary_parents [i].retriers = 0 ;
557559 if (tmp3) {
558560 memcpy (this ->secondary_parents [i].hash_string , tmp3 + 1 , strlen (tmp3));
559561 this ->secondary_parents [i].name = this ->secondary_parents [i].hash_string ;
@@ -1105,6 +1107,11 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
11051107 params->findParent (request, result, fail_threshold, retry_time); \
11061108 } while (0 )
11071109
1110+ #define SET_MAX_RETRIERS (x ) \
1111+ do { \
1112+ RecSetRecordInt (" proxy.config.http.parent_proxy.max_trans_retries" , x, REC_SOURCE_DEFAULT); \
1113+ } while (0 )
1114+
11081115 // start tests by marking up all tests hosts that will be marked down
11091116 // as part of testing. This will insure that test hosts are not loaded
11101117 // from records.snap as DOWN due to previous testing.
@@ -1117,6 +1124,8 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
11171124 _st.setHostStatus (" curly" , HOST_STATUS_UP, 0 , Reason::MANUAL);
11181125
11191126 // Test 1
1127+ SET_MAX_RETRIERS (20 );
1128+ RecSetRecordInt (" proxy.config.http.parent_proxy.max_trans_retries" , 20 , REC_SOURCE_DEFAULT);
11201129 tbl[0 ] = ' \0 ' ;
11211130 ST (1 );
11221131 T (" dest_domain=. parent=red:37412,orange:37412,yellow:37412 round_robin=strict\n " );
@@ -1831,6 +1840,39 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
18311840 FP;
18321841 RE (verify (result, PARENT_SPECIFIED, " carol" , 80 ), 211 );
18331842
1843+ // max_retriers tests
1844+ SET_MAX_RETRIERS (1 );
1845+
1846+ // Test 212
1847+ tbl[0 ] = ' \0 ' ;
1848+ ST (212 );
1849+ T (" dest_domain=mouse.com parent=mickey:80|0.33;minnie:80|0.33;goofy:80|0.33 "
1850+ " round_robin=consistent_hash go_direct=false\n " );
1851+ REBUILD;
1852+ REINIT;
1853+ br (request, " i.am.mouse.com" );
1854+ FP;
1855+ RE (verify (result, PARENT_SPECIFIED, " goofy" , 80 ), 212 );
1856+
1857+ // Test 213
1858+ // markdown goofy and minnie gets chosen.
1859+ ST (213 );
1860+ params->markParentDown (result, fail_threshold, retry_time); // marked down goofy
1861+ REINIT;
1862+ br (request, " i.am.mouse.com" );
1863+ FP;
1864+ RE (verify (result, PARENT_SPECIFIED, " minnie" , 80 ), 213 );
1865+
1866+ // Test 214
1867+ // goofy gets chosen because max_retriers was set to 1
1868+ // and goofy becomes available.
1869+ sleep (params->policy .ParentRetryTime + 2 );
1870+ ST (214 );
1871+ REINIT;
1872+ br (request, " i.am.mouse.com" );
1873+ FP;
1874+ RE (verify (result, PARENT_SPECIFIED, " goofy" , 80 ), 214 );
1875+
18341876 delete request;
18351877 delete result;
18361878 delete params;
0 commit comments