mirror of
https://github.com/typesense/typesense.git
synced 2025-05-21 22:33:27 +08:00
Comment out verbose debug logs for now.
This commit is contained in:
parent
efae9055bc
commit
120396489c
@ -601,7 +601,7 @@ bool post_import_documents(http_req& req, http_res& res) {
|
||||
|
||||
if(req.body_index == 0) {
|
||||
// will log for every major chunk of request body
|
||||
LOG(INFO) << "Import, req.body.size=" << req.body.size() << ", batch_size=" << IMPORT_BATCH_SIZE;
|
||||
//LOG(INFO) << "Import, req.body.size=" << req.body.size() << ", batch_size=" << IMPORT_BATCH_SIZE;
|
||||
//int nminusten_pos = std::max(0, int(req.body.size())-10);
|
||||
//LOG(INFO) << "Last 10 chars: " << req.body.substr(nminusten_pos);
|
||||
}
|
||||
@ -998,7 +998,7 @@ bool get_keys(http_req &req, http_res &res) {
|
||||
}
|
||||
|
||||
bool post_create_key(http_req &req, http_res &res) {
|
||||
LOG(INFO) << "post_create_key";
|
||||
//LOG(INFO) << "post_create_key";
|
||||
|
||||
CollectionManager & collectionManager = CollectionManager::get_instance();
|
||||
AuthManager &auth_manager = collectionManager.getAuthManager();
|
||||
@ -1083,7 +1083,7 @@ bool del_key(http_req &req, http_res &res) {
|
||||
}
|
||||
|
||||
bool raft_write_send_response(void *data) {
|
||||
LOG(INFO) << "raft_write_send_response called";
|
||||
//LOG(INFO) << "raft_write_send_response called";
|
||||
AsyncIndexArg* index_arg = static_cast<AsyncIndexArg*>(data);
|
||||
std::unique_ptr<AsyncIndexArg> index_arg_guard(index_arg);
|
||||
|
||||
@ -1103,12 +1103,12 @@ bool raft_write_send_response(void *data) {
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << "raft_write_send_response, async_res=" << async_res;
|
||||
//LOG(INFO) << "raft_write_send_response, async_res=" << async_res;
|
||||
|
||||
// only handle synchronous responses as async ones are handled by their handlers
|
||||
if(!async_res) {
|
||||
// send response and return control back to raft replication thread
|
||||
LOG(INFO) << "raft_write_send_response: sending response";
|
||||
//LOG(INFO) << "raft_write_send_response: sending response";
|
||||
server->send_response(index_arg->req, index_arg->res);
|
||||
}
|
||||
|
||||
|
@ -141,12 +141,12 @@ size_t HttpClient::curl_req_send_callback(char* buffer, size_t size, size_t nite
|
||||
|
||||
req_res->req->body_index += bytes_to_read;
|
||||
|
||||
LOG(INFO) << "Wrote " << bytes_to_read << " bytes to request body (max_buffer_bytes=" << max_req_bytes << ")";
|
||||
LOG(INFO) << "req_res->req->body_index: " << req_res->req->body_index;
|
||||
LOG(INFO) << "req_res->req->body.size(): " << req_res->req->body.size();
|
||||
//LOG(INFO) << "Wrote " << bytes_to_read << " bytes to request body (max_buffer_bytes=" << max_req_bytes << ")";
|
||||
//LOG(INFO) << "req_res->req->body_index: " << req_res->req->body_index;
|
||||
//LOG(INFO) << "req_res->req->body.size(): " << req_res->req->body.size();
|
||||
|
||||
if(req_res->req->body_index == req_res->req->body.size()) {
|
||||
LOG(INFO) << "Current body buffer has been consumed fully.";
|
||||
//LOG(INFO) << "Current body buffer has been consumed fully.";
|
||||
|
||||
req_res->req->body_index = 0;
|
||||
req_res->req->body = "";
|
||||
@ -154,16 +154,16 @@ size_t HttpClient::curl_req_send_callback(char* buffer, size_t size, size_t nite
|
||||
HttpServer *server = req_res->server;
|
||||
|
||||
if(req_res->req->last_chunk_aggregate) {
|
||||
LOG(INFO) << "Request forwarding done.";
|
||||
//LOG(INFO) << "Request forwarding done.";
|
||||
server->get_message_dispatcher()->send_message(HttpServer::REQUEST_PROCEED_MESSAGE, req_res);
|
||||
} else {
|
||||
LOG(INFO) << "Pausing forwarding and requesting more input.";
|
||||
//LOG(INFO) << "Pausing forwarding and requesting more input.";
|
||||
server->get_message_dispatcher()->send_message(HttpServer::REQUEST_PROCEED_MESSAGE, req_res);
|
||||
|
||||
LOG(INFO) << "Waiting for request body to be ready";
|
||||
//LOG(INFO) << "Waiting for request body to be ready";
|
||||
req_res->req->await.wait();
|
||||
LOG(INFO) << "Request body is ready";
|
||||
LOG(INFO) << "Buffer refilled, unpausing request forwarding, body_size=" << req_res->req->body.size();
|
||||
//LOG(INFO) << "Request body is ready";
|
||||
//LOG(INFO) << "Buffer refilled, unpausing request forwarding, body_size=" << req_res->req->body.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ size_t HttpClient::curl_req_send_callback(char* buffer, size_t size, size_t nite
|
||||
|
||||
size_t HttpClient::curl_write_async(char *buffer, size_t size, size_t nmemb, void *context) {
|
||||
// callback for response body to be sent back to client
|
||||
LOG(INFO) << "curl_write_async";
|
||||
//LOG(INFO) << "curl_write_async";
|
||||
deferred_req_res_t* req_res = static_cast<deferred_req_res_t *>(context);
|
||||
|
||||
if(req_res->req->_req == nullptr) {
|
||||
@ -200,20 +200,20 @@ size_t HttpClient::curl_write_async(char *buffer, size_t size, size_t nmemb, voi
|
||||
req_res->res->body = std::string(buffer, res_size);
|
||||
req_res->res->final = false;
|
||||
|
||||
LOG(INFO) << "curl_write_async response, res body size: " << req_res->res->body.size();
|
||||
//LOG(INFO) << "curl_write_async response, res body size: " << req_res->res->body.size();
|
||||
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, req_res);
|
||||
|
||||
// wait until response is sent
|
||||
LOG(INFO) << "Waiting for response to be sent";
|
||||
//LOG(INFO) << "Waiting for response to be sent";
|
||||
req_res->res->await.wait();
|
||||
LOG(INFO) << "Response sent";
|
||||
//LOG(INFO) << "Response sent";
|
||||
|
||||
return res_size;
|
||||
}
|
||||
|
||||
size_t HttpClient::curl_write_async_done(void *context, curl_socket_t item) {
|
||||
LOG(INFO) << "curl_write_async_done";
|
||||
//LOG(INFO) << "curl_write_async_done";
|
||||
|
||||
deferred_req_res_t* req_res = static_cast<deferred_req_res_t *>(context);
|
||||
req_res->res->body = "";
|
||||
|
@ -432,8 +432,8 @@ int HttpServer::async_req_cb(void *ctx, h2o_iovec_t chunk, int is_end_stream) {
|
||||
request->body += chunk_str;
|
||||
request->chunk_len += chunk.len;
|
||||
|
||||
LOG(INFO) << "async_req_cb, chunk.len=" << chunk.len << ", aggr_chunk_len=" << request->chunk_len
|
||||
<< ", is_end_stream=" << is_end_stream;
|
||||
//LOG(INFO) << "async_req_cb, chunk.len=" << chunk.len << ", aggr_chunk_len=" << request->chunk_len
|
||||
// << ", is_end_stream=" << is_end_stream;
|
||||
|
||||
//LOG(INFO) << "request->body.size(): " << request->body.size() << ", request->chunk_len=" << request->chunk_len;
|
||||
|
||||
@ -588,17 +588,17 @@ void HttpServer::response_abort(h2o_generator_t *generator, h2o_req_t *req) {
|
||||
}
|
||||
|
||||
void HttpServer::response_proceed(h2o_generator_t *generator, h2o_req_t *req) {
|
||||
LOG(INFO) << "response_proceed called";
|
||||
//LOG(INFO) << "response_proceed called";
|
||||
h2o_custom_generator_t* custom_generator = reinterpret_cast<h2o_custom_generator_t*>(generator);
|
||||
|
||||
custom_generator->response->await.notify();
|
||||
|
||||
LOG(INFO) << "proxied_stream: " << custom_generator->response->proxied_stream;
|
||||
LOG(INFO) << "response.final: " << custom_generator->response->final;
|
||||
//LOG(INFO) << "proxied_stream: " << custom_generator->response->proxied_stream;
|
||||
//LOG(INFO) << "response.final: " << custom_generator->response->final;
|
||||
|
||||
if(custom_generator->response->proxied_stream) {
|
||||
// request progression should not be tied to response generation
|
||||
LOG(INFO) << "Ignoring request proceed";
|
||||
//LOG(INFO) << "Ignoring request proceed";
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ void HttpServer::response_proceed(h2o_generator_t *generator, h2o_req_t *req) {
|
||||
custom_generator->request->chunk_len = 0;
|
||||
|
||||
if(custom_generator->request->_req->proceed_req) {
|
||||
LOG(INFO) << "response_proceed: proceeding req";
|
||||
//LOG(INFO) << "response_proceed: proceeding req";
|
||||
custom_generator->request->_req->proceed_req(custom_generator->request->_req, written, stream_state);
|
||||
}
|
||||
} else {
|
||||
@ -622,10 +622,10 @@ void HttpServer::response_proceed(h2o_generator_t *generator, h2o_req_t *req) {
|
||||
}
|
||||
|
||||
void HttpServer::stream_response(http_req& request, http_res& response) {
|
||||
LOG(INFO) << "stream_response called";
|
||||
//LOG(INFO) << "stream_response called";
|
||||
if(request._req == nullptr) {
|
||||
// raft log replay or when underlying request is aborted
|
||||
LOG(INFO) << "request._req == nullptr";
|
||||
//LOG(INFO) << "request._req == nullptr";
|
||||
destroy_request_response(&request, &response);
|
||||
return;
|
||||
}
|
||||
@ -634,8 +634,8 @@ void HttpServer::stream_response(http_req& request, http_res& response) {
|
||||
h2o_custom_generator_t* custom_generator = reinterpret_cast<h2o_custom_generator_t *>(response.generator);
|
||||
|
||||
if (req->res.status == 0) {
|
||||
LOG(INFO) << "h2o_start_response, content_type=" << response.content_type_header
|
||||
<< ",response.status_code=" << response.status_code;
|
||||
//LOG(INFO) << "h2o_start_response, content_type=" << response.content_type_header
|
||||
// << ",response.status_code=" << response.status_code;
|
||||
response.status_code = (response.status_code == 0) ? 503 : response.status_code; // just to be sure
|
||||
req->res.status = response.status_code;
|
||||
req->res.reason = http_res::get_status_reason(response.status_code);
|
||||
@ -645,8 +645,8 @@ void HttpServer::stream_response(http_req& request, http_res& response) {
|
||||
h2o_start_response(req, &custom_generator->super);
|
||||
}
|
||||
|
||||
LOG(INFO) << "stream_response, body_size: " << response.body.size() << ", response_final="
|
||||
<< custom_generator->response->final;
|
||||
//LOG(INFO) << "stream_response, body_size: " << response.body.size() << ", response_final="
|
||||
// << custom_generator->response->final;
|
||||
|
||||
h2o_iovec_t body = h2o_strdup(&req->pool, response.body.c_str(), SIZE_MAX);
|
||||
response.body = "";
|
||||
@ -766,14 +766,14 @@ uint64_t HttpServer::node_state() const {
|
||||
}
|
||||
|
||||
bool HttpServer::on_stream_response_message(void *data) {
|
||||
LOG(INFO) << "on_stream_response_message";
|
||||
//LOG(INFO) << "on_stream_response_message";
|
||||
deferred_req_res_t* req_res = static_cast<deferred_req_res_t *>(data);
|
||||
stream_response(*req_res->req, *req_res->res);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HttpServer::on_request_proceed_message(void *data) {
|
||||
LOG(INFO) << "on_request_proceed_message";
|
||||
//LOG(INFO) << "on_request_proceed_message";
|
||||
deferred_req_res_t* req_res = static_cast<deferred_req_res_t *>(data);
|
||||
auto stream_state = (req_res->req->last_chunk_aggregate) ? H2O_SEND_STATE_FINAL : H2O_SEND_STATE_IN_PROGRESS;
|
||||
|
||||
|
@ -124,7 +124,7 @@ void ReplicationState::write(http_req* request, http_res* response) {
|
||||
// To avoid ABA problem
|
||||
task.expected_term = leader_term.load(butil::memory_order_relaxed);
|
||||
|
||||
LOG(INFO) << ":::" << "body size before apply: " << request->body.size();
|
||||
//LOG(INFO) << ":::" << "body size before apply: " << request->body.size();
|
||||
|
||||
// Now the task is applied to the group, waiting for the result.
|
||||
return node->apply(task);
|
||||
@ -150,7 +150,7 @@ void ReplicationState::follower_write(http_req *request, http_res *response) con
|
||||
|
||||
if (request->_req->proceed_req && response->proxied_stream) {
|
||||
// indicates async request body of in-flight request
|
||||
LOG(INFO) << "Inflight proxied request, returning control to caller, body_size=" << request->body.size();
|
||||
//LOG(INFO) << "Inflight proxied request, returning control to caller, body_size=" << request->body.size();
|
||||
request->await.notify();
|
||||
return ;
|
||||
}
|
||||
@ -186,7 +186,7 @@ void ReplicationState::follower_write(http_req *request, http_res *response) con
|
||||
delete request;
|
||||
delete response;
|
||||
|
||||
LOG(INFO) << "Import call done.";
|
||||
//LOG(INFO) << "Import call done.";
|
||||
|
||||
if(status == 500) {
|
||||
response->content_type_header = res_headers["content-type"];
|
||||
@ -223,7 +223,7 @@ void ReplicationState::follower_write(http_req *request, http_res *response) con
|
||||
}
|
||||
|
||||
void ReplicationState::on_apply(braft::Iterator& iter) {
|
||||
LOG(INFO) << "ReplicationState::on_apply";
|
||||
//LOG(INFO) << "ReplicationState::on_apply";
|
||||
|
||||
// NOTE: this is executed on a different thread and runs concurrent to http thread
|
||||
// A batch of tasks are committed, which must be processed through
|
||||
@ -268,9 +268,9 @@ void ReplicationState::on_apply(braft::Iterator& iter) {
|
||||
auto replication_arg = new AsyncIndexArg{request, response, nullptr};
|
||||
message_dispatcher->send_message(REPLICATION_MSG, replication_arg);
|
||||
|
||||
LOG(INFO) << "Raft write waiting to proceed";
|
||||
//LOG(INFO) << "Raft write waiting to proceed";
|
||||
response->await.wait();
|
||||
LOG(INFO) << "Raft write ready to proceed, response->final=" << response->final;
|
||||
//LOG(INFO) << "Raft write ready to proceed, response->final=" << response->final;
|
||||
|
||||
if(response->final) {
|
||||
delete request;
|
||||
|
Loading…
x
Reference in New Issue
Block a user