[BREAKING] Add CLI command for database initialization#617
Conversation
…ust be executed after the database is healthy and running, and before performing any operation against the database. Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
| t.Helper() | ||
| client := createValidatorAndCommitClientWithTLS(t, &env.ServerConfigs[0].GRPC.Endpoint, cfg) | ||
| _, err := client.SetupSystemTablesAndNamespaces(ctx, nil) | ||
| _, err := client.SetLastCommittedBlockNumber(ctx, nil) |
There was a problem hiding this comment.
I don't think this is needed
There was a problem hiding this comment.
SetupSystemTablesAndNamespaces RPC was called to make sure the client actually connected or not in the TestVCSecureConnection. Since this PR removes it, we should call another RPC to verify the same behavior.
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
cendhu
left a comment
There was a problem hiding this comment.
I recommend reusing the vc config for the db-init command, as it isn't a standalone component and relies on vc code anyway. We already follow this pattern by reusing the service config for health checks, so we can take the same approach here. Furthermore, since this command will be used very rarely (primarily during initial setup and occasional version upgrades), introducing a dedicated config is overkill and adds unnecessary code.
…to reuse the VC configuration. Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
Type of change
Description
init-dbCLI command that allows administrators to initialize the database (create system tables, metadata tables, and system namespaces) as a standalone operation before starting services. The change includes a BREAKING API modification: the SetupSystemTablesAndNamespaces RPC method has been removed from theVCservice as database initialization is now performed via CLI instead of gRPC.Additional details
committer init-db --config vc.yamlRelated issues