Skip to content

Internals

O2eg edited this page Apr 17, 2022 · 12 revisions

This page shows the basic logic of packet processing. The common logic and handling exceptions is implemented in the worker_db_func method of DBCCore class and in local function steps_processing, which calls the execute_step or execute_ro_step method depending on the packet type (read-only or any other type).

The exception filters are in the execute_step and worker_db_func methods. The reconnection logic in case of an exception is implemented in the main loop of worker_db_func method.

class DBCCore:
    # ...
    @threaded
    def worker_db_func(self, thread_name, db_conn_str, db_name, packet_name, read_only):
        # ...
        while do_work:    # main loop
            do_work = False
            try:
                        # ...
			def steps_processing(run_once=False):
                            # ...
			th_result, exception_descr, do_work = steps_processing()
                        # ...

 

 

For each processed database will be launched a pair of threads: worker_db_func and lock_observer.

Case 5 is successful, and the packet status will be recorded as successful.

Case 3 causes the db_converter to sleep for conn_exception_sleep_interval seconds and reconnect or re-create a transaction.

All other scenarios mean that package deployment was not completed successfully:

  • an exception during work, for example, accessing a non-existent database object
  • db_converter's work was interrupted

Clone this wiki locally