- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
// https://github.com/vk-com/kphp-kdb/blob/ce6dead5b3345f4b38487cc9e45d55ced3dd7139/bayes/bayes-data.c#L1966
int init_all (kfs_file_handle_t Index) {
int i;
log_ts_exact_interval = 1;
ltbl_init (&user_table);
bl_head = qmalloc (sizeof (black_list));
black_list_init (bl_head);
int f = load_header (Index);
jump_log_ts = header.log_timestamp;
jump_log_pos = header.log_pos1;
jump_log_crc32 = header.log_pos1_crc32;
int user_cnt = index_users = header.user_cnt;
if (user_cnt < 1000000) {
user_cnt = 1000000;
}
assert (user_cnt >= 1000000);
user_cnt *= 1.1;
while (user_cnt % 2 == 0 || user_cnt % 5 == 0) {
user_cnt++;
}
ltbl_set_size (&user_table, user_cnt);
users = qmalloc (sizeof (user) * user_cnt);
for (i = 0; i < user_cnt; i++) {
user_init (&users[i]);
}
LRU_head = users;
LRU_head->next_used = LRU_head->prev_used = LRU_head;
if (f) {
try_init_local_uid();
}
if (index_mode) {
buff = qmalloc (max_words * sizeof (entry_t));
new_buff = qmalloc (4000000 * sizeof (entry_t));
}
return f;
}