Skip to content

storage: factor out initialization of storage hosts#13924

Merged
cjubb39 merged 1 commit into
MaterializeInc:mainfrom
benesch:storage-init
Jul 28, 2022
Merged

storage: factor out initialization of storage hosts#13924
cjubb39 merged 1 commit into
MaterializeInc:mainfrom
benesch:storage-init

Conversation

@benesch

@benesch benesch commented Jul 28, 2022

Copy link
Copy Markdown
Contributor

@cjubb39 as we discussed today! I figured I'd get a CI run out overnight for validation of this fix.


There were two issues with the initialization of storage hosts:

  • Creating new sources in an already initialized controller sent the
    InitializationComplete command after sending the initial
    CreateSources command. This was not wrong in practice, because the
    storage host in this case was sure to be empty and performing
    reconciliation was therefore a no-op, but it was conceptually
    incorrect.

  • Creating new sink did not send InitializationComplete, which
    presented as storaged processes never receiving the CreateExports
    command.

This commit solves both of these issues by pushing responsibility for
sending InitializationComplete into the StorageHosts object. Once
StorageHosts::initialization_complete is called, new storage hosts are
sent the InitializeComplete command during provisioning; the create
source and create sink code paths no longer both need to remember to
do this, nor can they send the command in the wrong order.

Co-authored-by: Chae Jubb chae@materialize.com

Motivation

  • This PR fixes a bug @cjubb39 was experiencing in a WIP branch.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (Not adding tests because they'll be covered by Chae's forthcoming PR.)

  • This PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way) and therefore is tagged with a T-protobuf label.

  • This PR includes the following user-facing behavior changes:

    • n/a

There were two issues with the initialization of storage hosts:

  * Creating new sources in an already initialized controller sent the
    `InitializationComplete` command *after* sending the initial
    `CreateSources` command. This was not wrong in practice, because the
    storage host in this case was sure to be empty and performing
    reconciliation was therefore a no-op, but it was conceptually
    incorrect.

  * Creating   new sink did not send `InitializationComplete`, which
    presented as `storaged` processes never receiving the CreateExports
    command.

This commit solves both of these issues by pushing responsibility for
sending `InitializationComplete` into the `StorageHosts` object. Once
`StorageHosts::initialization_complete` is called, new storage hosts are
sent the `InitializeComplete` command during provisioning; the create
source and create sink code paths no longer *both* need to remember to
do this, nor can they send the command in the wrong order.

Co-authored-by: Chae Jubb <chae@materialize.com>
@benesch benesch requested a review from cjubb39 July 28, 2022 04:36
@benesch benesch marked this pull request as ready for review July 28, 2022 04:36
@cjubb39 cjubb39 merged commit 9b2eb6d into MaterializeInc:main Jul 28, 2022
@benesch benesch deleted the storage-init branch July 29, 2022 17:15
madelynnblue added a commit that referenced this pull request Jul 29, 2022
Revert "storage: factor out initialization of storage hosts (#13924)"
benesch added a commit to benesch/materialize that referenced this pull request Jul 29, 2022
benesch added a commit to benesch/materialize that referenced this pull request Jul 30, 2022
benesch added a commit to benesch/materialize that referenced this pull request Jul 30, 2022
benesch added a commit that referenced this pull request Jul 31, 2022
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

Successfully merging this pull request may close these issues.

2 participants