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

Speed up begin stage #407

Open
cherbst opened this issue Jan 20, 2025 · 5 comments
Open

Speed up begin stage #407

cherbst opened this issue Jan 20, 2025 · 5 comments

Comments

@cherbst
Copy link

cherbst commented Jan 20, 2025

Right now it is not possible to execute the begin staging using an existing staging directory. But using rsync it would be totally possible to update an existing staging directory and thus speedup the begin stage. Why does this restriction exist and can we drop it?

@TravisCarden
Copy link
Collaborator

It's just to prevent you from accidentally overwriting an existing application, causing corruption or data loss. I think it's a firm requirement. However, since you apparently know what you're doing, you could easily get around the limitation by using the stage operation instead, since that's really what you're doing from a technical perspective. Would that work for you?

@cherbst
Copy link
Author

cherbst commented Jan 22, 2025

I am not sure I understand that correctly. Do you mean I should skip the begin operation the second time and just use stage? But then the changes from the active directory wouldn't be synchronized back to the staging directory, right? But that would be necessary.

@TravisCarden
Copy link
Collaborator

Oops; I meant to say commit, not stage. Since you already have a staging directory, you don't need to begin anymore--that's effectively already been done. What you're doing now from a technical perspective is essentially committing the active directory to the staging directory. So you'll just commit in both directions:

sequenceDiagram
    Active Dir->>+Staging Dir: begin (already happened)
    Active Dir->>+Active Dir: live changes apparently?
    Active Dir->>+Staging Dir: commit (instead of begin)
    Staging Dir->>+Staging Dir: stage
    Staging Dir->>+Active Dir: commit
Loading

@cherbst
Copy link
Author

cherbst commented Jan 30, 2025

Thanks for your detailed explanation TravisCarden! If I understand correctly the first commit switches the active and staging directories, right? So it treats the active directory as the staging directory and vice versa. I think this solution would work very well for me but unfortunately, it seems that the commit command does not respect the exclude options. At least for me it copies over the whole staging directory (the actual active directory). Is this my fault (I am using my fork of the console command: https://github.com/konnektiv/composer-stager-console/tree/include-dirs) or is this by design?

@TravisCarden
Copy link
Collaborator

the first commit switches the active and staging directories, right?

It syncs them, if that's what you mean. In simple terms, the first commit--from staging to active--will update and overwrite the staging directory with the active directory.

it seems that the commit command does not respect the exclude options.

No, it definitely respects exclusions. You can see it working in my automated tests: https://github.com/php-tuf/composer-stager/blob/develop/tests/EndToEnd/EndToEndFunctionalTest.php#L251. The problem seems likely to be in your implementation.

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

No branches or pull requests

2 participants