[server] Fix a few bugs.

Database related:
* Handle exception raised by libzdb ResultSet_next();
* GC should stop if fail to get repo list due to I/O error.
* Monitor shouldn't create tables on startup.
* Handle database creation failure on startup.
* Fix transaction bug in seaf_branch_manager_test_and_update_branch().
* Only retry a fix number of times in gen_new_commit().

Others:
* "common.h" should be included as the first header file.
* Fix a bug in accept_connection().