Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to exercise sharding logic in Vitess, we need our integration test environment to use sharded keyspaces, which means we need to use vindexes. This PR enables vindexes and changes DB initialization in support. It does not yet shard the keyspaces since doing so causes some consistency issues I still need to debug.
DB initialization: stop using sql-migrate inside the boulder container. Make the bmariadb and bvitess containers responsible for applying schemas when they start up. Use different database / keyspace names for different test environments:
boulder_sa/boulder_sa_next. This allows the two to coexist, which means we don't need todown --volumesthebmariadbcontainer when running locally and switching from./tn.shto./t.sh. Thebmariadbimage has support for applying SQL schemas from a directory. Thevttestserverhas support for applying SQL schemas and vschemas from a directory.Note: for the sake of getting things working, I made a separate copy of the SQL schema for each of (mariadb, vitess) x (boulder_sa, boulder_sa_next). This is definitely not good enough since they will drift out of date. Looking for feedback on the cleanest way to use a single source of truth. One obstacle: the SQL files used for
bmariadbmust have aUSEstatement at the top. The SQL files use forbvitessmust not have aUSEstatement at the top (the keyspace name comes from the directory structure).Foreign keys: we had one foreign key constraint (
serials.registrationID->registrations), but we probably don't actually want this in the Vitess world. It makes things more complicated with no benefit. I removed it from the SQL schemas.test/db.go: Invttestserverwe can't delete more than 10k rows, so I changeddeleteEverythingInAllTablesto delete in a loop. Incidentally I cleaned up some stuff about foreign keys and1 = 1that is no longer needed. Also, I changed deletion calls insa_test.goto use the shared deletion functions.test/vars/vars.go: calculate DSNs based on theBOULDER_CONFIG_DIRvariables, to select betweenboulder_saandboulder_sa_next(etc.).