Skip to content

Commit 1be60a2

Browse files
committed
NDB memcache: fix S scheduler to use version 2 of multiwait
1 parent e229918 commit 1be60a2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

storage/ndb/memcache/src/schedulers/S_sched.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights
2+
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights
33
reserved.
44
55
This program is free software; you can redistribute it and/or
@@ -824,9 +824,8 @@ void * S::Connection::run_ndb_poll_thread() {
824824
DEBUG_ENTER();
825825

826826
NdbInstance *inst;
827-
Ndb ** ready_list;
828827
int wait_timeout_millisec = 5000;
829-
int min_ready;
828+
int pct_ready;
830829
int in_flight = 0;
831830

832831
while(1) {
@@ -841,24 +840,24 @@ void * S::Connection::run_ndb_poll_thread() {
841840
inst->next = 0;
842841
DEBUG_PRINT(" ** adding %d.%d to wait group ** ",
843842
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+
}
847847
}
848848

849849
/* 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;
852851

853852
/* 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);
855854

856855
/* Poll the ones that are ready */
857856
if(nwaiting > 0) {
858857
for(int i = 0; i < nwaiting ; i++) {
859858
in_flight--;
860859
assert(in_flight >= 0);
861-
Ndb *db = ready_list[i];
860+
Ndb *db = pollgroup->pop();
862861
inst = (NdbInstance *) db->getCustomData();
863862
DEBUG_PRINT("Polling %d.%d", inst->wqitem->pipeline->id, inst->wqitem->id);
864863
db->pollNdb(0, 1);
@@ -883,7 +882,6 @@ void * S::Connection::run_ndb_poll_thread() {
883882
}
884883
}
885884
return 0; /* not reached */
886-
return 0; /* not reached */
887885
}
888886

889887

0 commit comments

Comments
 (0)