|
4 | 4 | #include <stdbool.h> |
5 | 5 | #include <stdlib.h> |
6 | 6 | #include <signal.h> |
| 7 | +#include <time.h> |
7 | 8 |
|
8 | 9 | #include <pthread.h> |
9 | 10 | #include <fcntl.h> |
@@ -59,10 +60,10 @@ static void close_server() { |
59 | 60 | remove_client(client->connfd); |
60 | 61 | } |
61 | 62 |
|
62 | | - write_log(LOG_WARN, "Saving data..."); |
| 63 | + clock_t start = clock(); |
63 | 64 | save_data(); |
64 | 65 | close_database_fd(); |
65 | | - write_log(LOG_INFO, "Saved data and closed database file."); |
| 66 | + write_log(LOG_INFO, "Saved data and closed database file in %.2f seconds.", ((float) clock() - start) / CLOCKS_PER_SEC); |
66 | 67 |
|
67 | 68 | deactive_transaction_thread(); |
68 | 69 | usleep(15); |
@@ -90,6 +91,14 @@ void start_server(struct Configuration *config) { |
90 | 91 | conf = config; |
91 | 92 | initialize_logs(conf); |
92 | 93 | write_log(LOG_INFO, "Initialized logs and configuration."); |
| 94 | + write_log(LOG_INFO, "version=" VERSION ", commit hash=" GIT_HASH); |
| 95 | + |
| 96 | + if (conf->default_conf) { |
| 97 | + write_log(LOG_WARN, ( |
| 98 | + "There is no configuration file, using default configuration. " |
| 99 | + "To specify, create .tellyconf file or use `telly config /path/to/file`." |
| 100 | + )); |
| 101 | + } |
93 | 102 |
|
94 | 103 | load_commands(); |
95 | 104 | write_log(LOG_INFO, "Initialized commands."); |
@@ -144,12 +153,12 @@ void start_server(struct Configuration *config) { |
144 | 153 | return; |
145 | 154 | } |
146 | 155 |
|
147 | | - create_cache(); |
| 156 | + struct BTree *cache = create_cache(); |
148 | 157 | open_database_fd(conf->data_file); |
149 | 158 | write_log(LOG_INFO, "Created cache and opened database file."); |
150 | 159 |
|
151 | 160 | get_all_keys(); |
152 | | - write_log(LOG_INFO, "Read database file to create keyspace."); |
| 161 | + write_log(LOG_INFO, "Read database file to create keyspace. Loaded key count: %d", cache->size); |
153 | 162 |
|
154 | 163 | nfds = 1; |
155 | 164 | fds = malloc(sizeof(struct pollfd)); |
|
0 commit comments