From 8047b9f359bdc4b70de9826e6477d3a6b4d6e54c Mon Sep 17 00:00:00 2001 From: Kishore Nallan Date: Wed, 3 Jul 2024 13:20:53 +0530 Subject: [PATCH] When alter fails unexpectedly, reset alter running state. --- src/batched_indexer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/batched_indexer.cpp b/src/batched_indexer.cpp index 0138799a..a206415d 100644 --- a/src/batched_indexer.cpp +++ b/src/batched_indexer.cpp @@ -291,12 +291,18 @@ void BatchedIndexer::run() { try { found_rpath->handler(orig_req, orig_res); } catch(const std::exception& e) { - LOG(ERROR) << "Exception while calling handler " << found_rpath->_get_action(); + const std::string& api_action = found_rpath->_get_action(); + LOG(ERROR) << "Exception while calling handler " << api_action; LOG(ERROR) << "Raw error: " << e.what(); // bad request gets a response immediately orig_res->set_400("Bad request."); orig_res->final = true; async_res = false; + + // clean up state + if(api_action == "collections:update") { + set_alter_in_progress(false); + } } prev_body = orig_req->body; } else {