Skip to content

Conversation

@traeak
Copy link
Contributor

@traeak traeak commented Feb 25, 2020

A direct port of regex_revalidate to c++ with added targeted messages:

traffic_ctl plugin msg regex_revalidate config_reload
traffic_ctl plugin msg regex_revalidate config_print

The config_reload option allows only regex_revalidate to be reloaded outside of a traffic_ctl config reload
The config_print option will dump current active rules and times to traffic.out (or stderr)

This version uses a std::vector<> of rules which benchmarks faster than the c linked list implementation.
Also an attempt was made to clean up rule loading and pruning.

Based on #7322, the following mode will be available (now WIP):

  • Last rule wins, which allows rules to be changed or even unloaded through expiration.
  • Any changed rule will have its revalidation activation time reset.

Resolves #7322

Also added the ability to optionally add the keyword "MISS" at the end of a configure line to force an asset refetch instead of just an IMS check.

@bryancall bryancall added this to the 10.0.0 milestone Feb 26, 2020
@traeak
Copy link
Contributor Author

traeak commented Feb 28, 2020

[approve ci autest]
I think this is legitimately busted for now....nope not busted, behavior changed which allows an existing rule end date to be changed.

@traeak traeak force-pushed the regex_reval_cpp branch 5 times, most recently from 018f4c8 to f22c6a5 Compare June 30, 2020 15:24
@traeak traeak force-pushed the regex_reval_cpp branch from f22c6a5 to ac4825e Compare July 8, 2020 18:44
@traeak traeak marked this pull request as ready for review July 9, 2020 13:13
@traeak traeak force-pushed the regex_reval_cpp branch from ac4825e to 9ad73b1 Compare July 9, 2020 13:15
@traeak
Copy link
Contributor Author

traeak commented Jul 9, 2020

I'm not a big fan of all the rvalue boilerplate for the Invalidate struct.
Should I refactor to use tscore/Regex ?
For the time being I created yet another regex.h/regex.cc, additions made to efficiently extract the needed substrings.
Refactoring/extending tscore/Regex.h to replace many of these custom classes should be done.
the config_handler function has the bulk of the logic changes.

@traeak traeak force-pushed the regex_reval_cpp branch 3 times, most recently from 4c72385 to e9f3372 Compare July 10, 2020 15:59
@traeak
Copy link
Contributor Author

traeak commented Sep 30, 2020

I think I will need to add a backwards compatibility mode so that mixed environments can be consistent...not necessary....

@traeak
Copy link
Contributor Author

traeak commented Nov 13, 2020

Changed requirements based on a compelling end user/limited self service use case from #7322

@traeak traeak force-pushed the regex_reval_cpp branch 2 times, most recently from 7668e65 to f9cd7fc Compare November 23, 2020 17:19
@bryancall
Copy link
Contributor

[approve ci]

@bryancall
Copy link
Contributor

@ywkaras is going to take a look at this.

TSContDataSet(config_cont, static_cast<void *>(pstate));

// constantly run this for rule grooming
TSContScheduleOnPool(config_cont, CONFIG_TMOUT, TS_THREAD_POOL_TASK);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems convoluted to schedule this, then ignore the event it generates, when timed_reload is false.

Copy link
Contributor Author

@traeak traeak Apr 7, 2021

Choose a reason for hiding this comment

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

convoluted is correct. Even with timed_reload disabled any expired rules will still be pruned out so this needs to still be run.

@traeak traeak force-pushed the regex_reval_cpp branch 4 times, most recently from 392f90d to 1ed1f3a Compare April 7, 2021 17:55
@traeak traeak changed the title regex_revalidate c++ and lifecycle message reload regex_revalidate c++, lifecycle messages, MISS support Apr 9, 2021
@traeak traeak force-pushed the regex_reval_cpp branch 2 times, most recently from 9892352 to b7a7b20 Compare April 12, 2021 21:54
@@ -1,524 +0,0 @@
/** @file
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you do git mv regex_revalidate.c regex_revalidate.cc before you started editing? This might have been a faster review if it was easier to see what was changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps. the changes are fairly destructive regardless.


setup_config_cont(pstate);

TSCont const main_cont = TSContCreate(main_handler, nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't the two continuations need the same mutex since they both access pstate?

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 believe that wouldn't allow the invalidation and the config continuations to run asynchronously. That's what the atomic locks for pstate does. I'm guessing this might break if global plugin reloading is enabled?

@traeak traeak force-pushed the regex_reval_cpp branch from 898d445 to 232a98c Compare May 7, 2021 19:39
@traeak traeak requested a review from bryancall as a code owner May 7, 2021 19:39
traeak added a commit to traeak/trafficserver that referenced this pull request May 7, 2021
… via trailing MISS keyword

(cherry picked from commit 232a98c) (apache#6455)
traeak added a commit to traeak/trafficserver that referenced this pull request May 26, 2021
… via trailing MISS keyword

(cherry picked from commit 232a98c) (apache#6455)
@traeak traeak closed this May 27, 2021
@zwoop zwoop modified the milestones: 10.0.0, 9.2.0 Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regex_revalidate immutable rules confusing

5 participants