Skip to content

Provide idempotent way to initalise database #5166

@jacekn

Description

@jacekn

Description

Explain in detail the additional functionality you would like to see in stellar-core.

Currently the new-db command wipes the database content (if there was any) and recreates it.
I'd like to have a way to initialize the database but in a safe, idempotent, way.

Explain why this feature is important

In a dynamic environments, such as k8s, it would be very convenient if I could run a command each time a pod starts to ensure database is initialized. Currently the only ways to initialize the database in a safe way are:

  1. Run the new-db command manually. The downside of this method is that it require human intervention
  2. Write some tooling to detect whether new-db is needed and run it if so. The downside of this method is the fact that operators need to write and maintain custom tooling.

Describe the solution you'd like

This could be solved by adding a new flag, for example --init-only, telling the new-db command to skip destructive operations.

Describe alternatives you've considered

I think improvement to the migrate-up command could also help. If the command could be made to install schema if it doesn't exist that would solve the problem.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions