1
1
/*
2
- Copyright (c) 2011, 2016 , Oracle and/or its affiliates. All rights
2
+ Copyright (c) 2011, 2017 , Oracle and/or its affiliates. All rights
3
3
reserved.
4
4
5
5
This program is free software; you can redistribute it and/or
@@ -824,9 +824,8 @@ void * S::Connection::run_ndb_poll_thread() {
824
824
DEBUG_ENTER ();
825
825
826
826
NdbInstance *inst;
827
- Ndb ** ready_list;
828
827
int wait_timeout_millisec = 5000 ;
829
- int min_ready ;
828
+ int pct_ready ;
830
829
int in_flight = 0 ;
831
830
832
831
while (1 ) {
@@ -841,24 +840,24 @@ void * S::Connection::run_ndb_poll_thread() {
841
840
inst->next = 0 ;
842
841
DEBUG_PRINT (" ** adding %d.%d to wait group ** " ,
843
842
inst->wqitem ->pipeline ->id , inst->wqitem ->id );
844
- pollgroup->addNdb (inst->db );
845
- n_added++;
846
- in_flight++;
843
+ if (! pollgroup->push (inst->db )) {
844
+ n_added++;
845
+ in_flight++;
846
+ }
847
847
}
848
848
849
849
/* What's the minimum number of ready Ndb's to wake up for? */
850
- int n = n_added / 4 ;
851
- min_ready = n > 0 ? n : 1 ;
850
+ pct_ready = (n_added > 4 ) ? 25 : 1 ;
852
851
853
852
/* Wait until something is ready to poll */
854
- int nwaiting = pollgroup->wait (ready_list, wait_timeout_millisec, min_ready );
853
+ int nwaiting = pollgroup->wait (wait_timeout_millisec, pct_ready );
855
854
856
855
/* Poll the ones that are ready */
857
856
if (nwaiting > 0 ) {
858
857
for (int i = 0 ; i < nwaiting ; i++) {
859
858
in_flight--;
860
859
assert (in_flight >= 0 );
861
- Ndb *db = ready_list[i] ;
860
+ Ndb *db = pollgroup-> pop () ;
862
861
inst = (NdbInstance *) db->getCustomData ();
863
862
DEBUG_PRINT (" Polling %d.%d" , inst->wqitem ->pipeline ->id , inst->wqitem ->id );
864
863
db->pollNdb (0 , 1 );
@@ -883,7 +882,6 @@ void * S::Connection::run_ndb_poll_thread() {
883
882
}
884
883
}
885
884
return 0 ; /* not reached */
886
- return 0 ; /* not reached */
887
885
}
888
886
889
887
0 commit comments