Skip to content

Conversation

georgeliao
Copy link
Contributor

@georgeliao georgeliao commented Nov 5, 2024

  1. alias
  2. aliases
  3. authenticate: does not check state
  4. clone: already done
  5. delete: already done
  6. exec: does not check state
  7. find: does not check state
  8. get: does not check state
  9. help: does not check state
  10. info: does not check state
  11. launch: not needed
  12. list: does not check state
  13. mount: already done
  14. networks: not needed
  15. prefer:
  16. purge: does not check state
  17. recover: already done
  18. restart: done
  19. restore: done
  20. set: done
  21. shell: does not check state
  22. snapshot: done
  23. start: hard to do, due to the coupling with Daemon::async_wait_for_ready_all->grpc_status_for
  24. stop: already done
  25. suspend: already done
  26. transfer:
  27. umount: already done
  28. unalias:
  29. version: does not check state

About the client side handler of these changed operations, snapshot, restore and restart all use standard_failure_handler_for function, meaning that there is no distinguishment between INVALID_ARGUMENT and FAILED_PRECONDITION. Likewise, set also did not distinguish that via a different way.

MULTI-1559
Settle the discussion

@ricab
Copy link
Collaborator

ricab commented Nov 6, 2024

For set, perhaps we could have an InstanceStateSettingsException to distinguish? But I'm fine if we don't too. As it stands, I don't think the client would make a distinction anyway.

@georgeliao
Copy link
Contributor Author

For set, perhaps we could have an InstanceStateSettingsException to distinguish? But I'm fine if we don't too. As it stands, I don't think the client would make a distinction anyway.

We can do that, it is just adding a new exception.

@georgeliao georgeliao force-pushed the unify_invalid_state_to_failed_precondition branch from 268762f to 12d5f1f Compare November 6, 2024 12:07
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.95%. Comparing base (6c4b8b4) to head (19a50a2).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/daemon/daemon.cpp 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3764      +/-   ##
==========================================
- Coverage   88.95%   88.95%   -0.01%     
==========================================
  Files         256      256              
  Lines       14579    14583       +4     
==========================================
+ Hits        12969    12972       +3     
- Misses       1610     1611       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@georgeliao georgeliao force-pushed the unify_invalid_state_to_failed_precondition branch from 5c80bf6 to ff60ac2 Compare November 15, 2024 13:56
@@ -72,6 +72,12 @@ class InstanceSettingsException : public SettingsException
InstanceSettingsException(const std::string& reason, const std::string& instance, const std::string& detail);
};

class InstanceStateSettingsException : public SettingsException
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it make more sense to derive from InstanceSettingsException (which has the exact same constructor code)?

Conceptually, an InstanceStateSettingsException is-a InstanceSettingsException. OTOH, when we deal with instance-related settings exceptions, we want to include InstanceStateSettingsException too (except when the handling for InstanceStateSettingsException is specific, but then we would place the correponding catch clause first).

Am I missing something? Is there any case where we want to handle InstanceSettingsException but not InstanceStateSettingsException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then we would place the correponding catch clause first).

I think I was thinking that the client code can be order agnostic when I implemented this.

catch (const mp::InvalidSettingException& e)
{
    status_promise->set_value(grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, e.what(), ""));
}
catch (const mp::InstanceStateSettingsException& e)
{
    status_promise->set_value(grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, e.what(), ""));
}

This would still work. However, maybe it is better to use inheritance because they do conceptually have the is-a relationship.

Copy link
Contributor

@Sploder12 Sploder12 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 overall! Just a few questions and minor notes

@georgeliao georgeliao force-pushed the unify_invalid_state_to_failed_precondition branch from ff60ac2 to 77b7049 Compare November 25, 2024 09:13
@georgeliao
Copy link
Contributor Author

@Sploder12 Sorry that the PR was not rebased so the scope of it got messed up. All your comments are on the clone polishing PR, we can still discuss it for the sake of clarity.

Sploder12
Sploder12 previously approved these changes Nov 25, 2024
Copy link
Contributor

@Sploder12 Sploder12 left a comment

Choose a reason for hiding this comment

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

@Sploder12 Sorry that the PR was not rebased so the scope of it got messed up. All your comments are on the clone polishing PR, we can still discuss it for the sake of clarity.

No worries, thank you for the clarifying comments! Everything looks good to me!

ricab
ricab previously approved these changes Nov 26, 2024
Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

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

Thank you @georgeliao!

@ricab
Copy link
Collaborator

ricab commented Nov 26, 2024

(This is waiting for the base PR to merge first.)

@georgeliao georgeliao force-pushed the unify_invalid_state_to_failed_precondition branch from ebe6e34 to 8eb343e Compare November 29, 2024 09:20
Base automatically changed from clone_polishing to main November 29, 2024 12:38
@ricab ricab dismissed stale reviews from Sploder12 and themself November 29, 2024 12:38

The base branch was changed.

@georgeliao
Copy link
Contributor Author

@ricab @Sploder12 , now we can approve the review and get this ready to merge.

Copy link
Contributor

@Sploder12 Sploder12 left a comment

Choose a reason for hiding this comment

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

LGTM!

@ricab
Copy link
Collaborator

ricab commented Dec 2, 2024

Hey @georgeliao, does this need a rebase perhaps? Compilation is failing on win/mac platforms because of an override.

@georgeliao
Copy link
Contributor Author

@ricab will have a look.

@georgeliao georgeliao force-pushed the unify_invalid_state_to_failed_precondition branch from 8eb343e to 19a50a2 Compare December 2, 2024 10:19
@georgeliao
Copy link
Contributor Author

@ricab , now it can be merged, I believe.

@ricab ricab enabled auto-merge December 2, 2024 12:03
@ricab ricab added this pull request to the merge queue Dec 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 2, 2024
@georgeliao georgeliao added this pull request to the merge queue Dec 2, 2024
Merged via the queue into main with commit bf396bd Dec 2, 2024
13 of 14 checks passed
@georgeliao georgeliao deleted the unify_invalid_state_to_failed_precondition branch December 2, 2024 15:02
ricab pushed a commit that referenced this pull request Feb 7, 2025
…_precondition

[daemon] unified restart, restore and snapshot to grpc::FAILED_PRECON…
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.

3 participants