Server goes through the following process during the startup or shutdown.
- Server system initialization
- Read system parameters from configure file
- Initialize message catalog module. (cubrid.cat, csql.cat, utils.cat)
- Initialize thread manager. Initialize TSD and allocate area for all thread entry. Set master thread and initialize other threads
- Initialize critical section: From now on, we can use critical section
- Initialize error system. er_set() and error system can be used
- Initialize the client/server interface
- Initialize database (global structures has been init'ed) in boot_restart_server()
- client / server system (css) initialization
- Connect to master server: record the connection in global variables.
- Start up all worker/daemon threads: server could accept request now.
- Thread system initialization
- Initialize css_Job_queue
- Start workers: Worker threads and daemon threads are created and booted up (pthread_create() is called) . Each thread’s thread_entry is updated.
- Master thread performs
- Check the status of the connection to master.
- Check the status of the socket to master.
- When the master thread receives a request from cub master, it will create a new job and will put it into css_Job_queue. Worker thread pulls out one from job queue when it performs a job.
- What’s this function for? css_process_shutdown_request
- master thread termination
- Delete all jobs in css_Job_queue.
- Thread system shutdown
- Stop all worker threads and daemon threads.
- Kill all worker threads (send exit signal).
- Final job queue: Release the resource of job queue.
- Client/server system shutdown
- Shutdown all active connections
- Free connection list
- End server system
- Shutdown database: destroy system parameters, abort all transactions, remove temp volumes, terminate log manager and etc….
- Kill all workers.
- Finalize all critical sections
- Finalize thread manager