Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 8fe7314

Browse files
authored
Sqldb rip boltdb (#2341)
* serverless sqldb use same env for test config as normal * rip boltdb implementation of controller backend out it was replaced by postgres and no longer works properly. This involved migrating a number of tests which only worked with boltdb, which exposed several ways in which the postgres implementation had slightly different behavior from the bolt one: 1. ordering of results in some cases, and 2. (more importantly) erroring when a record to delete was not found. The bolt implementation silently ignored it when things to delete weren't found, so we make some changes to match that behavior. Also stopped propagating CreatedAt and UpdatedAt from DB tables into dax types. These were breaking existing tests. Perhaps it would be better to actually use them, but for now they will only exist at the DB level. This change set also moves the insertion of the directive_versions record out of migrations and into the startup/connection code. Having this in the migrations was a bit ugly because you couldn't just truncate all the tables and have everything work from scratch. Inserting it during startup is fairly innocuous, and will just continue on if it already exists. * update directive_version test I changed the initial value to 0 so that the first version that gets sent out is 1
1 parent f5f7c5e commit 8fe7314

32 files changed

Lines changed: 146 additions & 3657 deletions

.gitlab/.gitlab-ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ run go tests race:
256256
image: golang:$GOVERSION
257257
extends: .go-cache
258258
variables:
259-
SQLDB_DB: run_go_tests_race
259+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests_race
260260
POSTGRES_DB: run_go_tests_race
261-
SQLDB_USER: postgres
261+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
262262
POSTGRES_USER: postgres
263-
SQLDB_PASSWORD: $POSTGRES_PASSWORD
263+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
264264
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
265-
SQLDB_HOST: postgres
265+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
266266
services:
267267
- postgres:14.7
268268
rules:
@@ -287,13 +287,13 @@ run go tests:
287287
image: golang:$GOVERSION
288288
extends: .go-cache
289289
variables:
290-
SQLDB_DB: run_go_tests
290+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests
291291
POSTGRES_DB: run_go_tests
292-
SQLDB_USER: postgres
292+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
293293
POSTGRES_USER: postgres
294-
SQLDB_PASSWORD: $POSTGRES_PASSWORD
294+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
295295
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
296-
SQLDB_HOST: postgres
296+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
297297
services:
298298
- postgres:14.7
299299
rules:
@@ -319,13 +319,13 @@ run go tests dax/test/dax:
319319
tags:
320320
- docker
321321
variables:
322-
SQLDB_DB: run_go_tests_dax
322+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests_dax
323323
POSTGRES_DB: run_go_tests_dax
324-
SQLDB_USER: postgres
324+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
325325
POSTGRES_USER: postgres
326-
SQLDB_PASSWORD: $POSTGRES_PASSWORD
326+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
327327
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
328-
SQLDB_HOST: postgres
328+
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
329329
services:
330330
- postgres:14.7
331331
rules:

ctl/dax.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func BuildDAXFlags(cmd *cobra.Command, srv *server.Command) {
1717
// Controller
1818
flags.BoolVar(&srv.Config.Controller.Run, "controller.run", srv.Config.Controller.Run, "Run the Controller service in process.")
1919
flags.DurationVar(&srv.Config.Controller.Config.RegistrationBatchTimeout, "controller.config.registration-batch-timeout", srv.Config.Controller.Config.RegistrationBatchTimeout, "Timeout for node registration batches.")
20-
flags.StringVar(&srv.Config.Controller.Config.DataDir, "controller.config.data-dir", srv.Config.Controller.Config.DataDir, "Controller directory to use in process.")
2120
flags.StringVar(&srv.Config.Controller.Config.StorageMethod, "controller.config.storage-method", srv.Config.Controller.Config.StorageMethod, "Backing store. boltdb or sqldb.")
2221
flags.DurationVar(&srv.Config.Controller.Config.SnappingTurtleTimeout, "controller.config.snapping-turtle-timeout", srv.Config.Controller.Config.SnappingTurtleTimeout, "Period for running automatic snapshotting routine.")
2322

dax/boltdb/boltdb.go

Lines changed: 0 additions & 165 deletions
This file was deleted.

dax/boltdb/boltdb_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

dax/boltdb/directiveversion.go

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)