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

!!! FEATURE: Improve escr cli commands #4864

Merged
merged 9 commits into from
Feb 15, 2024

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Jan 31, 2024

Resolves: #4772

As discussed in the last weekly the following changes were made.

  • cr:replayAll was renamed to cr:projectionReplayAll
  • cr:replay was renamed to cr:projectionReplay
  • cr:projectionReplay and cr:projectionReplayAll now both warn before continue and have a --force flag.
  • cr:prune has a --force flag.
  • cr:setup has a --reset-projections flag.

Additionally cr:projectionReplayAll has a simple progress indicator.

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

* @param string $contentRepository Identifier of the Content Repository instance to operate on
* @param bool $quiet If set only fatal errors are rendered to the output
*/
public function resetAllCommand(string $contentRepository = 'default', bool $quiet = false): void
Copy link
Member Author

Choose a reason for hiding this comment

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

maybe for people not reading the comments it might be misleading to have cr:prune and cr:resetAll in the same namespace.

Maybe we should add the Projection suffix?

cr:resetAllProjections

cr:replayAllProjections

cr:replayProjection

or we add another command controller:

projection:resetAll

projection:replayAll

projection:replay?

Copy link
Member

Choose a reason for hiding this comment

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

I agree here. Actually I struggle to understand what reset really means. What does it do? Why and when should someone use this command?

TBH I would have expected a better description in the PR for that as it will get into the changelog.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this pr is not to be merged as is :)

my proposed new command will reset all the projections. This is implicit the first step of replayAll.

The reasoning to include is are: that we have a command to prune everything cr:prune and as the cr api allows to throw away all projections (like a cache flush) we should also allow this.

That command will most likely only be used when cr:setup fails because there is data in the projections. Basically for a super clean setup. Which hopefully is never need in 9.0 stable but was for example for #4791.

Copy link
Member

Choose a reason for hiding this comment

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

Then we probably should include this change in some way and update the PR description of #4791 afterwards 😉. As of now the description is misleading.

Copy link
Member Author

Choose a reason for hiding this comment

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

the real hopefully not that present usecase past 9.0 would be cr:setup --reset-projections.
Maybe that would be the way to go?

But i also prefer those commands:

cr:resetAllProjections

cr:replayAllProjections

cr:replayProjection

instead of the implicit cr:replayAll

Copy link
Member Author

Choose a reason for hiding this comment

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

cr:projectionReplayAll

cr:projectionReplay

prefer cr:setup --reset-projections over cr:projectionResetAll

@mhsdesign mhsdesign marked this pull request as draft February 7, 2024 08:26
@mhsdesign
Copy link
Member Author

mhsdesign commented Feb 11, 2024

cr:projectionResetAll with confirmation and progress bar:

/home/neos: flow cr:projectionReplayAll          
> This will replay all projections in "default", which may take some time. Are you sure to proceed? (y/n) y
Replaying events for all projections of Content Repository "default" ...
 * replaying contentStream projection
 * replaying workspace projection
 * replaying nodeHiddenState projection
 * replaying documentUriPath projection
 * replaying change projection
 * replaying contentGraph projection
 * replaying assetUsage projection
Done.

--reset-projections flag:

/home/neos: flow cr:setup --reset-projections    
> Advanced Mode. The flag --reset-projections will reset all projections in "default", which leaves you with empty projections to be replayed. Are you sure to proceed? (y/n) y
All projections of Content Repository "default" were resettet.
Content Repository "default" was set up

And i noticed one other thing.

cr:projectionReplayAll seems much faster than replaying the contentGraph projection via flow cr:projectionReplay contentGraph. How can that beeeeeee?
-> that seems to be only an issue on my system? https://neos-project.slack.com/archives/C04PYL8H3/p1707730652428639

@mhsdesign mhsdesign marked this pull request as ready for review February 11, 2024 18:51
@mhsdesign mhsdesign requested a review from ahaeslich February 12, 2024 08:38
@mhsdesign mhsdesign force-pushed the task/improveEscrCliCommands branch from e6bd941 to 9b0147b Compare February 12, 2024 21:14
and improve code of `cr:prune` by using `resetAllProjections` instead of `replayAll` as this was done before only implicit.
as suggested and discussed by christian
as a relay all will just to that at first, but then there is no event to catch up to.
Reset is more obvious that way.
* adds `ContentRepositoryStatus::isOk` for simplicity
@mhsdesign mhsdesign force-pushed the task/improveEscrCliCommands branch from 9b0147b to fc87012 Compare February 12, 2024 21:18
@mhsdesign mhsdesign changed the title FEATURE: Improve escr cli commands !!! FEATURE: Improve escr cli commands Feb 15, 2024
@mhsdesign mhsdesign merged commit d57947a into neos:9.0 Feb 15, 2024
10 checks passed
@mhsdesign mhsdesign deleted the task/improveEscrCliCommands branch February 15, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9.0 Improve CLI commands for the new ESCR
3 participants