Migration #1488
Replies: 2 comments 1 reply
-
Hey @chubei. Some points for us to think about.
|
Beta Was this translation helpful? Give feedback.
-
To summarize previous call:
@v3g42 Am I missing anything? |
Beta Was this translation helpful? Give feedback.
-
Migration
Migration File Structure
Currently Dozer data are organized as follows (assuming endpoints are
trips
andzones
):To support migration, we separate api proto files to make endpoints independent from each other, and scope endpoints by migration sequence number:
The migration will happen on endpoint level, which means we may have three migrations for
trips
but only one migration forzones
.dozer migrate
For every endpoint defined in the configuration file, dozer checks if all the following conditions are met:
pipeline/logs/{endpoint}/v{n}/schema.json
exists.pipeline/logs/{endpoint}/v{n}/log
doesn't exist.where
{n}
is the latest migration.If all the conditions are met, migration is not needed, otherwise a new migration is created.
The reasoning behind these conditions are:
dozer app run
Dozer app runs on the latest migration, because previous migrations can be invalid when the schema from the data source changes.
Based on the migration condition above, dozer app doesn't need to handle checkpointing, because the latest migration always has a schema and no log.
dozer api run
Endpoint config gets a new parameter
version
to specify the migration to use. It can either be a number orlatest
(default).Dozer api builds cache from the log in the specified migration.
Checkpointing
An
offset
parameter is added toRwCache::commit
to support checkpointing. When dozer api restarts, it reads log from the committed offset and continues to build cache.Switching
Currently dozer api serves following REST paths (assuming endpoint path is
/trips
):GET /trips
GET /trips/{pk}
POST /trips/count
POST /trips/query
POST /trips/oapi
And following gRRC methods:
Trips.count
Trips.query
CommonGrpcService.count
withendpoint
set totrips
CommonGrpcService.query
withendpoint
set totrips
To support switching, we additionally serve following REST paths:
GET /v{n}/trips
GET /v{n}/trips/{pk}
POST /v{n}/trips/count
POST /v{n}/trips/query
POST /v{n}/trips/oapi
And following gRRC methods:
TripsV{n}.count
TripsV{n}.query
CommonGrpcService.count
withendpoint
set totrips
and migration set ton
CommonGrpcService.query
withendpoint
set totrips
and migration set ton
The original REST paths and gRPC methods will be redirected to the migration specified in the configuration file.
Dozer api additionally supports creating APIs on the fly by specifying
endpoint
andmigration
, and redirect the unscoped REST paths and gRPC methods to any migration.I'm not sure if this is necessary because the user can just starts a new dozer api instance with a different configuration file, and points the load balancer to the new instance when needed.
Beta Was this translation helpful? Give feedback.
All reactions