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

BUGFIX 4508 mark dependands of live outdated after direct change #5274

Open
wants to merge 10 commits into
base: 9.0
Choose a base branch
from

Conversation

mhsdesign
Copy link
Member

FIXES: #4508

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

@@ -56,11 +55,13 @@ public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace
{
$workspaceByNameStatement = <<<SQL
SELECT
Copy link
Member Author

Choose a reason for hiding this comment

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

should we deduplicate this logic using a querybuilder?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so

Comment on lines 60 to 62
{$this->tableNames->workspace()} ws
JOIN {$this->tableNames->contentStream()} cs ON cs.id = ws.currentcontentstreamid
LEFT JOIN {$this->tableNames->contentStream()} scs ON cs.sourceContentStreamId = scs.id
Copy link
Member Author

Choose a reason for hiding this comment

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

so the performance trait is this: we still have the status in the workspace, but we have to calculate it slightly more expensive with these two joins.
I cannot say if this is better performance than having on the write side a similar complex update logic for each event. But as findWorkspaceByName (and implicitly getContentGraph) trigger this query and are also part of the write side for constraint checks we have to carefully evaluate.

@mhsdesign mhsdesign force-pushed the task/add-workspace-contentstream-mapping-to-contentgraph branch from c374314 to db7861f Compare October 10, 2024 08:20
Base automatically changed from task/add-workspace-contentstream-mapping-to-contentgraph to 9.0 October 17, 2024 11:11
@github-actions github-actions bot added the 9.0 label Oct 17, 2024
@mhsdesign mhsdesign force-pushed the bugfix/4508-mark-dependands-of-live-outdated-after-direct-change branch from f928255 to 26e2de7 Compare October 17, 2024 12:21
@mhsdesign mhsdesign marked this pull request as ready for review October 17, 2024 12:24
Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

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

Looks great already, just a comment regarding "expected version"

Comment on lines 151 to 155
$expectedSourceVersion = ExpectedVersion::fromVersion(Version::fromInteger($row['expectedSourceVersion']));

if (!$expectedSourceVersion->isSatisfiedBy($sourceVersion)) {
$status = WorkspaceStatus::OUTDATED;
}
Copy link
Member

Choose a reason for hiding this comment

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

Mostly a naming thing, but the "expected version" is something for the write side, i.e. I trigger a command and I expect the model to be of a given version.
In this case it is just two versions of content streams.

@@ -55,11 +57,13 @@ public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace
{
$workspaceByNameStatement = <<<SQL
SELECT
name, baseWorkspaceName, currentContentStreamId, status
ws.name, ws.baseWorkspaceName, ws.currentContentStreamId, cs.sourceContentStreamVersion as expectedSourceVersion, scs.version as sourceVersion
Copy link
Member

Choose a reason for hiding this comment

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

As discussed: Maybe we can simplify this to sth like:

Suggested change
ws.name, ws.baseWorkspaceName, ws.currentContentStreamId, cs.sourceContentStreamVersion as expectedSourceVersion, scs.version as sourceVersion
ws.name, ws.baseWorkspaceName, ws.currentContentStreamId, cs.sourceContentStreamVersion = scs.version as isUpToDate

…oid fetching full workspace model

with the extra joins in the workspace model it is just easier to just select the current content stream id directly
Copy link
Member

@nezaniel nezaniel left a comment

Choose a reason for hiding this comment

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

Looks nice

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.

BUG: Running ./flow structureadjustments:fix doesn't mark workspaces as outdated
3 participants