Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@d-w-moore
Copy link
Contributor

No description provided.

if ( atoi( timespan ) > 0 ) {
elapseTime = atoi( timespan ) * 3600;
char *endc{};
if (int scanned_number = strtol( timespan, &endc, 10 ); nullptr != endc && *endc == 's') {
Copy link
Contributor

Choose a reason for hiding this comment

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

This appears to change the behavior of the MSI.

The docs state the time is in hours. It doesn't mention seconds being supported. What motivated this change?

What happens if the user passes "250 s"?

Copy link
Contributor Author

@d-w-moore d-w-moore Apr 3, 2023

Choose a reason for hiding this comment

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

The basic motivation is to allow a test that doesn't take hours. As it is, the row purge takes "default" or a quoted integer, and "default" or "0" results in keeping any rows less old than the default window of 24hr , which is too long a runtime for a test. Best case we'd use "1", which would make the window 1 hour ... or ... optionally allow seconds as units, which was the path I chose.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood. I think we may need to move this to 4.3 only.

This PR is introducing an enhancement which doesn't feel mandatory for 4.2.12. It may also introduce more bugs due to edge cases with the seconds suffix.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the unit is optional and the behavior does not change for existing usage, I feel like it is okay. Do you have a specific concern in mind?

One positive effect is that this MSI is now being tested, which was not the case before.

Copy link
Contributor Author

@d-w-moore d-w-moore Apr 4, 2023

Choose a reason for hiding this comment

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

Understood. I think we may need to move this to 4.3 only.

@korydraughn I'm easy... it doesn't seem that critical to me that the purge msi work properly on 4.2.x, as those who run it are probably already well familiar with the problem and - I'm sure - run a cron job to do the same thing.

@alanking - testing and documention will both be nice-to-haves. Which actually brings me to this: the only reason this test of msiServerMonPerf is not currently failing in our container based core test-suite is that we're not using -r irods_rule_engine_plugin-irods_rule_language-instance in the irule invocation. :O

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ways of holding it wrong are, as far as I can think of and haven't allowed for yet:

  • too small or large an integer, that is negative or greater than numeric_limits<int>::max()
  • use of some bizarre form of whitespace ("\f", "\r", etc)
  • units other than (s)econds, ie. assuming we offer (m)inutes as well

Copy link
Contributor

Choose a reason for hiding this comment

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

If you can detect invalid input and reject it, then I think we will be in a good spot to ship this in 4.2.12.

Try and make it very strict about what it will accept. That way, no one can hold it wrong.

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 can patch up the holes, no problem. Do we expect we'll want to allow all time units (s,m,h,d,y) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not for 4.2.12 unless it's trivial to implement correctly.

Years seems excessive and days can be defined in terms of hours.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, ok thanks.


namespace {

auto seconds_from_integer_time_and_units(const char *numstring) -> std::tuple<int,std::string>
Copy link
Contributor

Choose a reason for hiding this comment

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

getOffsetTimeStr seems to be basically the same parser as the one written here, but the default unit is seconds instead of hours. This is used by the delay server to figure out when to execute things, so it has had more exposure to the elements as far as error handling and testing.

Perhaps we could hook into this, somehow, and avoid having 2 of these?

@alanking
Copy link
Contributor

#6350 has been bumped to 4.3.2 milestone, so this will be closed without merging. Leaving it open for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants