Add more td_init logging.
GitOrigin-RevId: 98b5a8e3234ec57cb24d833c726c6d1c2d938992
This commit is contained in:
parent
b0724c1f32
commit
c435360799
@ -3990,6 +3990,7 @@ Status Td::init(DbKey key) {
|
|||||||
}
|
}
|
||||||
LOG(INFO) << "Successfully inited database in " << tag("database_directory", parameters_.database_directory)
|
LOG(INFO) << "Successfully inited database in " << tag("database_directory", parameters_.database_directory)
|
||||||
<< " and " << tag("files_directory", parameters_.files_directory);
|
<< " and " << tag("files_directory", parameters_.files_directory);
|
||||||
|
VLOG(td_init) << "Successfully inited database";
|
||||||
G()->init(parameters_, actor_id(this), r_td_db.move_as_ok()).ensure();
|
G()->init(parameters_, actor_id(this), r_td_db.move_as_ok()).ensure();
|
||||||
|
|
||||||
// Init all managers and actors
|
// Init all managers and actors
|
||||||
@ -4455,11 +4456,11 @@ Status Td::fix_parameters(TdParameters ¶meters) {
|
|||||||
VLOG(td_init) << "Fix files_directory";
|
VLOG(td_init) << "Fix files_directory";
|
||||||
parameters.files_directory = parameters.database_directory;
|
parameters.files_directory = parameters.database_directory;
|
||||||
}
|
}
|
||||||
if (parameters.use_message_db) {
|
if (parameters.use_message_db && !parameters.use_chat_info_db) {
|
||||||
VLOG(td_init) << "Fix use_chat_info_db";
|
VLOG(td_init) << "Fix use_chat_info_db";
|
||||||
parameters.use_chat_info_db = true;
|
parameters.use_chat_info_db = true;
|
||||||
}
|
}
|
||||||
if (parameters.use_chat_info_db) {
|
if (parameters.use_chat_info_db && !parameters.use_file_db) {
|
||||||
VLOG(td_init) << "Fix use_file_db";
|
VLOG(td_init) << "Fix use_file_db";
|
||||||
parameters.use_file_db = true;
|
parameters.use_file_db = true;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/logevent/LogEvent.h"
|
#include "td/telegram/logevent/LogEvent.h"
|
||||||
#include "td/telegram/MessagesDb.h"
|
#include "td/telegram/MessagesDb.h"
|
||||||
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/TdParameters.h"
|
#include "td/telegram/TdParameters.h"
|
||||||
#include "td/telegram/Version.h"
|
#include "td/telegram/Version.h"
|
||||||
|
|
||||||
@ -381,10 +382,14 @@ Status TdDb::init(int32 scheduler_id, const TdParameters ¶meters, DbKey key,
|
|||||||
config_pmc->external_init_begin(static_cast<int32>(LogEvent::HandlerType::ConfigPmcMagic));
|
config_pmc->external_init_begin(static_cast<int32>(LogEvent::HandlerType::ConfigPmcMagic));
|
||||||
|
|
||||||
bool encrypt_binlog = !key.is_empty();
|
bool encrypt_binlog = !key.is_empty();
|
||||||
|
VLOG(td_init) << "Start binlog loading";
|
||||||
TRY_STATUS(init_binlog(*binlog, get_binlog_path(parameters), *binlog_pmc, *config_pmc, events, std::move(key)));
|
TRY_STATUS(init_binlog(*binlog, get_binlog_path(parameters), *binlog_pmc, *config_pmc, events, std::move(key)));
|
||||||
|
VLOG(td_init) << "Finish binlog loading";
|
||||||
|
|
||||||
binlog_pmc->external_init_finish(binlog);
|
binlog_pmc->external_init_finish(binlog);
|
||||||
|
VLOG(td_init) << "Finish initialization of binlog PMC";
|
||||||
config_pmc->external_init_finish(binlog);
|
config_pmc->external_init_finish(binlog);
|
||||||
|
VLOG(td_init) << "Finish initialization of config PMC";
|
||||||
|
|
||||||
DbKey new_sqlite_key;
|
DbKey new_sqlite_key;
|
||||||
DbKey old_sqlite_key;
|
DbKey old_sqlite_key;
|
||||||
@ -405,7 +410,9 @@ Status TdDb::init(int32 scheduler_id, const TdParameters ¶meters, DbKey key,
|
|||||||
drop_sqlite_key = true;
|
drop_sqlite_key = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VLOG(td_init) << "Start to init database";
|
||||||
auto init_sqlite_status = init_sqlite(scheduler_id, parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc);
|
auto init_sqlite_status = init_sqlite(scheduler_id, parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc);
|
||||||
|
VLOG(td_init) << "Finish to init database";
|
||||||
if (init_sqlite_status.is_error()) {
|
if (init_sqlite_status.is_error()) {
|
||||||
LOG(ERROR) << "Destroy bad SQLite database because of " << init_sqlite_status;
|
LOG(ERROR) << "Destroy bad SQLite database because of " << init_sqlite_status;
|
||||||
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
||||||
@ -416,10 +423,12 @@ Status TdDb::init(int32 scheduler_id, const TdParameters ¶meters, DbKey key,
|
|||||||
binlog_pmc->force_sync(Auto());
|
binlog_pmc->force_sync(Auto());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VLOG(td_init) << "Create concurrent_binlog_pmc";
|
||||||
auto concurrent_binlog_pmc = std::make_shared<BinlogKeyValue<ConcurrentBinlog>>();
|
auto concurrent_binlog_pmc = std::make_shared<BinlogKeyValue<ConcurrentBinlog>>();
|
||||||
concurrent_binlog_pmc->external_init_begin(binlog_pmc->get_magic());
|
concurrent_binlog_pmc->external_init_begin(binlog_pmc->get_magic());
|
||||||
concurrent_binlog_pmc->external_init_handle(std::move(*binlog_pmc));
|
concurrent_binlog_pmc->external_init_handle(std::move(*binlog_pmc));
|
||||||
|
|
||||||
|
VLOG(td_init) << "Create concurrent_config_pmc";
|
||||||
auto concurrent_config_pmc = std::make_shared<BinlogKeyValue<ConcurrentBinlog>>();
|
auto concurrent_config_pmc = std::make_shared<BinlogKeyValue<ConcurrentBinlog>>();
|
||||||
concurrent_config_pmc->external_init_begin(config_pmc->get_magic());
|
concurrent_config_pmc->external_init_begin(config_pmc->get_magic());
|
||||||
concurrent_config_pmc->external_init_handle(std::move(*config_pmc));
|
concurrent_config_pmc->external_init_handle(std::move(*config_pmc));
|
||||||
@ -429,9 +438,12 @@ Status TdDb::init(int32 scheduler_id, const TdParameters ¶meters, DbKey key,
|
|||||||
config_pmc.reset();
|
config_pmc.reset();
|
||||||
|
|
||||||
CHECK(binlog_ptr != nullptr);
|
CHECK(binlog_ptr != nullptr);
|
||||||
|
VLOG(td_init) << "Create concurrent_binlog";
|
||||||
auto concurrent_binlog = std::make_shared<ConcurrentBinlog>(unique_ptr<Binlog>(binlog_ptr), scheduler_id);
|
auto concurrent_binlog = std::make_shared<ConcurrentBinlog>(unique_ptr<Binlog>(binlog_ptr), scheduler_id);
|
||||||
|
|
||||||
|
VLOG(td_init) << "Init concurrent_binlog_pmc";
|
||||||
concurrent_binlog_pmc->external_init_finish(concurrent_binlog);
|
concurrent_binlog_pmc->external_init_finish(concurrent_binlog);
|
||||||
|
VLOG(td_init) << "Init concurrent_config_pmc";
|
||||||
concurrent_config_pmc->external_init_finish(concurrent_binlog);
|
concurrent_config_pmc->external_init_finish(concurrent_binlog);
|
||||||
|
|
||||||
binlog_pmc_ = std::move(concurrent_binlog_pmc);
|
binlog_pmc_ = std::move(concurrent_binlog_pmc);
|
||||||
@ -449,17 +461,21 @@ Result<unique_ptr<TdDb>> TdDb::open(int32 scheduler_id, const TdParameters ¶
|
|||||||
TRY_STATUS(db->init(scheduler_id, parameters, std::move(key), events));
|
TRY_STATUS(db->init(scheduler_id, parameters, std::move(key), events));
|
||||||
return std::move(db);
|
return std::move(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<TdDb::EncryptionInfo> TdDb::check_encryption(const TdParameters ¶meters) {
|
Result<TdDb::EncryptionInfo> TdDb::check_encryption(const TdParameters ¶meters) {
|
||||||
return ::td::check_encryption(get_binlog_path(parameters));
|
return ::td::check_encryption(get_binlog_path(parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TdDb::change_key(DbKey key, Promise<> promise) {
|
void TdDb::change_key(DbKey key, Promise<> promise) {
|
||||||
get_binlog()->change_key(std::move(key), std::move(promise));
|
get_binlog()->change_key(std::move(key), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status TdDb::destroy(const TdParameters ¶meters) {
|
Status TdDb::destroy(const TdParameters ¶meters) {
|
||||||
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
||||||
Binlog::destroy(get_binlog_path(parameters)).ignore();
|
Binlog::destroy(get_binlog_path(parameters)).ignore();
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TdDb::with_db_path(std::function<void(CSlice)> callback) {
|
void TdDb::with_db_path(std::function<void(CSlice)> callback) {
|
||||||
SqliteDb::with_db_path(sqlite_path(), callback);
|
SqliteDb::with_db_path(sqlite_path(), callback);
|
||||||
callback(binlog_path());
|
callback(binlog_path());
|
||||||
|
Reference in New Issue
Block a user