Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-46430: Garbage collection of the completed table contribution requests #870

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

iagaponenko
Copy link
Contributor

The output collection of the completed/cancalled/failed requests has been eliminated to avoid accumilating memory over the lifetime of the worker service. Minor changes to the request processing manager habe been made. The unit test was adjusted accordingly. The changed do not affet clients of the Replication/Ingest system's REST API.

Copy link
Contributor

@jgates108 jgates108 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just minor typos.

@@ -128,8 +128,8 @@ json IngestHttpSvcMod::_asyncCancelRequest() const {
checkApiVersion(__func__, 13);

auto const id = stoul(params().at("id"));
auto const contrib = _ingestRequestMgr->cancel(id);
return json::object({{"contrib", contrib.toJson()}});
[[maybe_unused]] bool const cancelled = _ingestRequestMgr->cancel(id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cancelled is certainly not used here, so I'm not sure why it isn't just not defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it's useful (say, when one is debugging the application) to know if an element was removed or not. The return value is also meant to be used on the unit test... which I overlooked extending to check for the returned values of the method to ensure the method behaves correctly. I will fix the unit test. Thank you for noticing this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong - the new version of the unit test is already testing the completion status of the method.

@@ -158,7 +158,8 @@ json IngestHttpSvcMod::_asyncTransCancelRequests() const {
json contribsJson = json::array();
for (auto& contrib : contribs) {
try {
contribsJson.push_back(_ingestRequestMgr->cancel(contrib.id).toJson());
[[maybe_unused]] bool const cancelled = _ingestRequestMgr->cancel(contrib.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as other maybe_unused insance.

}
throw IngestRequestNotFound(context_ + string(__func__) + " request " + to_string(id) + " was not found");
// Nn such request found, or the request was already completed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nn -> No

* - The method may also throw exception should any problem happened while
* the method using other services (the Replication system's database, etc.).
*
* @param id The unique identifier of a request to be cancelled.
* @return The updated descriptor of the request.
* @throw IngestRequestNotFound If the request is unknown to the manager.
* @return 'true' if the request was found and successfully cancelled (or marked for cncellation).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cncellation -> cancellation

The output collection of the completed/cancalled/failed requests has
been eliminated to avoid accumilating memory over the lifetime of
the worker service. Minor changes to the request processing manager
habe been made. The unit test was adjusted accordingly. The changed
do not affet clients of the Replication/Ingest system's REST API.
@iagaponenko iagaponenko merged commit 8f2739c into main Sep 24, 2024
15 checks passed
@iagaponenko iagaponenko deleted the tickets/DM-46430 branch September 24, 2024 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants