-
Notifications
You must be signed in to change notification settings - Fork 5
Action tracker
When the database conversion (migration) is started for the first time, four tables are created in the target database containing information about all applied packets, their steps, and actions. Action tracker allows to save the state of the applied packets and their statuses and allows to resume migrations if they were interrupted abnormally or stopped by the operator.
The dbc_packets table consists of fields:
-
name- is a name of the packet being executed -
status- is a packet status. Possible values: -
-
started- the conversion for this package has been started but not completed, i.e., may have been interrupted or is in progress
-
-
-
exception- is an exception that occurred during conversion
-
-
-
done- deployment completed successfully
-
-
dt- is a date and time of the 1st start of conversion -
packet_hash- is a hash of all packet contents -
meta_data- is a jsonb format field to which the content of themeta_data.jsonfile is written
The dbc_steps table consists of fields:
-
name- is a SQL file (step) name -
packet_id- is the foreign key todbc_packets.id -
status- is a state of thestep. Possible values: -
-
started- a transaction (step) is in progress
-
-
-
exception- an exception occurred while executing a transaction
-
-
-
done- a transaction completed successfully
-
-
dt- is a date and time when the transaction started, if thestephas no placeholders -
exception_descr- is a description of exception, if it happened during thesteporaction
The dbc_actions table consists of fields:
-
dt- is a date and time of theaction -
packet_id- is the foreign key todbc_packets.id -
step_id- is the foreign key todbc_steps.id -
step_hash- is a hash of the SQL query that was executed in a database with considering the substitution of the generator values, if any
The dbc_locks table consists of fields:
-
name- is a name of the packet being executed -
locked-true | false. If deployment was interrupted abnormally, then it is necessary to release the lock using the--unlockoption before redeployment. -
dt- is a date and time when the lock was created
Suppose an action was unsuccessful (for example, a syntax error in a step), then the description of the exception will be written to dbc_steps.exception_descr and can be read using the --status key. Upon successful completion of the step, the field containing the description of the exception is cleared.
In addition to the statuses stored in the database, there are the following packet statuses:
class PacketStatus(BasicEnum, Enum):
DONE = 'done' # stored in dbc_packets.status
STARTED = 'started' # stored in dbc_packets.status
EXCEPTION = 'exception' # stored in dbc_packets.status
NEW = 'new' # if record not exists in "dbc_packets" table
UNKNOWN = 'unknown' # if target DB is not found