-
Notifications
You must be signed in to change notification settings - Fork 304
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
HPCC-30809 Add new ESP service WsSasha #18018
Conversation
Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
1. Create the sashaclilib which contains the code shared by both Sasha CLI and WsSasha. 2. Inside the sashaclilib, create the runSashaCommand() which is based on the existing code inside sasha.cpp's main() from building ISashaCommand to reading the command response. 3. Move the following from sasha.cpp to sashacli.cpp, so that they can be used by the runSashaCommand(): extractTimings, getNum(), DumpWorkunitTimings(), getVersion(). 4. Implement 5 WsSasha methods: GetVersion, ListWU, ArchiveWU, RestoreWU, and XREF. Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
@jakesmith The PR now has 2 commits for easy to review. I may squash them when needed. Please check this PR whether it is on correct direction or not. Please also comment on the questions and comments in the ecm file and other files. Some of comments may be removed before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wangkx - I have scanned over both commits.
1st commit looks good framework.
2nd commit, although not all of the functions, it highlights some issues.
I think for now, the scope of this should be further reduced, so we can get something past review and merged (bit size is best), then expand on it.
With that in mind, I'd keep the 1st commit, rollback the 2nd commit, and add an extremely limited service for now, e.g. that just handles SCA_GETVERSION for example.
Keep sasha.cpp more or less exactly as it was, but conditionally call runSashaCommand for the select command (e.g. SCA_GETVERSION).
In the short term, that may mean there's some duplication between the legacy sasha.cpp and saruncmd.cpp.
This PR and review can then focus on the new service and the impl. of runSashaCommand etc. - subsequent PR's can start moving more functionality to the service.
|
||
using namespace ws_sasha; | ||
|
||
constexpr const char* FEATURE_URL = "SashaAccess"; | ||
|
||
ISashaCommand* CWSSashaEx::setSashaCommand(SashaCommandAction action, bool dfu, SocketEndpoint& serverep) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why setXXX , it is a createXX method ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not use a createXX method because the createSashaCommand() (defined in sacmd.hpp) is called in line 34. I may rename this one to createAndSetSashaCommand.
|
||
#include "dautils.hpp" | ||
|
||
extern SASHACLI_API void runSashaCommand(SocketEndpoint ep, ISashaCommand *cmd, IFileIOStream *outfile, StringBuffer &outBuffer, bool viaESP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SocketEndpoint ep
don't want a copy - should probably be const reference
else | ||
msg.append("archived"); | ||
msg.append(", Continue (Y/N)"); | ||
if (!confirm(msg.str())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this likely need to change..
Anything that it is confirming to proceed, is running 2 commands (but it's wrapped at the moment into a single runSashaCommand).
Esp and the command line will likely handle asking to proceed in very different ways.
I think this logic should be split so runSashaCommand only ever runs 1 command, and in the cases of commands that want confirmation and then optionally run another, that logic is elsewhere, e.g. in the command line tool, or eclwatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly move out of the runSashaCommand()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and issue each command separately, i.e. split the bit after the confirm into a separate call to runSashaCommand
PROGLOG("Sasha server[%s]: Version %s",host.str(),id.str()); | ||
return; | ||
} | ||
if (viaESP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any of this common code should have/switch on viaESP.
Instead, it should behave the same, e.g. throw an exception, the caller should handle it as it wants to, e.g. in case of CLI - log it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no longer really "cli" .. since it's used for sasha command handling in general / by anything that wants to run command on the Sasha service.
Perhaps rename saruncmd.cpp
|
||
//ESPmethod [auth_feature("SashaAccess:READ")] ListDT(ListDTRequest, ResultResponse); | ||
// By reading the code, looks like: it lists ECL WUs or DFU WUs with date time (when?) in Archive server. | ||
// Should it be merged into the ListWU as an option (IncludeDateTime)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably, and related to prev. comment, if confirmed, then it would be fine to merge into single ecm request type with options, but I would not change the handling code that is moving from sasha.cpp into the service - or change as little as possible.
ESPmethod [auth_feature("SashaAccess:FULL")] RestoreWU(RestoreWURequest, ResultResponse); //restore ECL WUs or DFU WUs | ||
|
||
//ESPmethod [auth_feature("SashaAccess:FULL")] BackupWU(BackupWURequest, ResultResponse); //backup one ECL WU | ||
// Only backup an ECL WU (not DFU WU). How does it work? How to test? How about implementing in separate PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik, backing up/restoring dfu workunits is not supported (should be, but less of an issue because they are always tiny compared to ECL workunits).
How to test?
Not sure what you mean - you should be able to test backing up and restoring a ECL workunit manually, via the CLI, (and restore via Eclwatch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should ask: what is the difference between Archive and Backup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are the same, except Archive deletes the workunit from Dali as well, whereas Backup leave it in place.
ESPmethod [auth_feature("SashaAccess:FULL")] XREF(XREFRequest, ResultResponse); //generate XREF for clusters | ||
|
||
//ESPmethod [auth_feature("SashaAccess:FULL")] Stop(StopRequest, ResultResponse); | ||
// Stop what? How does it work? How to test? How about implementing in separate PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should perhaps be a Stop or Restart request.
How to test?
Not sure what you mean using existing CLI : sasha action=stop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Stop here matches with the existing CLI : sasha action=stop. Looks like that a Stop action (SCA_STOP) terminates a Sasha server. I haven't seen a Restart function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a restart, I was suggesting there perhaps should be (it is prob. more useful and a more common thing to want than to stop) - but don't add now, let's keep changes to a minimum.
// Stop what? How does it work? How to test? How about implementing in separate PR? | ||
|
||
//Do we need the following methods? They are not in the Sasha Usage, but, in Sasha code. If yes, how about implementing in separate PRs? | ||
//SCA_WORKUNIT_SERVICES_GET ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think needed by CLI or service, but still needed, i.e. components (like esp) that interact with Sasha directly, should still continue to allow this command to be created and sent to Sasha directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the SCA_WORKUNIT_SERVICES_GET (as well as coalesce_suspend and coalesce_resume) do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCA_WORKUNIT_SERVICES_GET
I can't recall exactly, but I don't think this new service needs to support it for now, it will not be something wanted by the CLI or UI, but instead used by other esp services that talk directly to sasha (afaics only used by wsWorkunitList atm).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coalesce_suspend and coalesce_resume)
One of sasha's function is to coalesce the dali store (aggregate the current store + in flight deltas into a new store file).
It is resource intensive, and I think the idea was to pause it, so other resource intensive sasha services like XREF, could have more capacity.
In cloud, I don't think coalesce_suspend/coalesce_resume make much sense, since each sasha service is in it's own dedicated container.
//Do we need the following methods? They are not in the Sasha Usage, but, in Sasha code. If yes, how about implementing in separate PRs? | ||
//SCA_WORKUNIT_SERVICES_GET ? | ||
//coalesce_suspend ? | ||
//coalesce_resume ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be added, but later.
This draft PR is not needed. |
Type of change:
Checklist:
Smoketest:
Testing: