| 886 | } |
| 887 | |
| 888 | void clusterRecruitStorage(ClusterControllerData* self, RecruitStorageRequest req) { |
| 889 | try { |
| 890 | if (!self->gotProcessClasses && !req.criticalRecruitment) |
| 891 | throw no_more_servers(); |
| 892 | auto worker = self->getStorageWorker(req); |
| 893 | RecruitStorageReply rep; |
| 894 | rep.worker = worker.interf; |
| 895 | rep.processClass = worker.processClass; |
| 896 | req.reply.send(rep); |
| 897 | } catch (Error& e) { |
| 898 | if (e.code() == error_code_no_more_servers) { |
| 899 | self->outstandingStorageRequests.emplace_back(req, now() + SERVER_KNOBS->RECRUITMENT_TIMEOUT); |
| 900 | TraceEvent(SevWarn, "RecruitStorageNotAvailable", self->id) |
| 901 | .error(e) |
| 902 | .detail("IsCriticalRecruitment", req.criticalRecruitment); |
| 903 | } else { |
| 904 | TraceEvent(SevError, "RecruitStorageError", self->id).error(e); |
| 905 | throw; // Any other error will bring down the cluster controller |
| 906 | } |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | // Trys to send a reply to req with a worker (process) that a blob worker can be recruited on |
| 911 | // Otherwise, add the req to a list of outstanding reqs that will eventually be dealt with |
no test coverage detected