This repository was archived by the owner on Dec 26, 2022. It is now read-only.
feat(db): Implement importer and listener for permanode#631
Open
YingHan-Chen wants to merge 1 commit intoDLTcollab:developfrom
Open
feat(db): Implement importer and listener for permanode#631YingHan-Chen wants to merge 1 commit intoDLTcollab:developfrom
YingHan-Chen wants to merge 1 commit intoDLTcollab:developfrom
Conversation
b95e2fd to
1271e47
Compare
howjmay
suggested changes
May 20, 2020
The listener subscribes newly confirmed transactions from IRI and adds inserting tasks into the task queue of thread pool. The importer reads confirmed transactions from historical transaction files dumped from IRI and adds inserting tasks into the task queue of thread pool. Each worker in the thread pool establishes a session connected to ScyllaDB cluster and takes inserting tasks.
1271e47 to
7475196
Compare
howjmay
suggested changes
May 21, 2020
|
|
||
| static status_t init_importer_data(db_importer_thread_t* thread_data, db_permanode_pool_t* pool, char* file_list) { | ||
| status_t ret = SC_OK; | ||
| pthread_mutex_init(&thread_data->thread_mutex, NULL); |
Contributor
There was a problem hiding this comment.
Do we need error checking here?
| status_t ret = SC_OK; | ||
| pthread_mutex_init(&thread_data->thread_mutex, NULL); | ||
| thread_data->pool = pool; | ||
| thread_data->file_path = strdup(file_list); |
|
|
||
| status_t ret = SC_OK; | ||
| db_importer_thread_t* thread_data = (db_importer_thread_t*)data; | ||
| pthread_mutex_lock(&thread_data->thread_mutex); |
| ta_log_error("Failed to open file %s\n", file_name_buffer); | ||
| goto exit; | ||
| } | ||
| ta_log_info("%s %s\n", "starting to import file : ", file_name_buffer); |
Contributor
There was a problem hiding this comment.
You will get an extra space after the colon
|
|
||
| exit: | ||
| if (ret == SC_OK) { | ||
| ta_log_info("%s %s\n", "Successfully import file : ", thread_data->file_path); |
| worker_threads = malloc(thread_num * sizeof(pthread_t)); | ||
| worker_data = malloc(thread_num * sizeof(db_worker_thread_t)); | ||
|
|
||
| db_permanode_thpool_init(&pool); |
| db_permanode_thpool_init_worker(worker_data + i, &pool, db_host); | ||
| pthread_create(&worker_threads[i], NULL, db_permanode_worker_handler, (void*)&worker_data[i]); | ||
| } | ||
| init_importer_data(&importer_data, &pool, file_path); |
| init_importer_data(&importer_data, &pool, file_path); | ||
| pthread_create(&importer_thread, NULL, (void*)importer_handler, (void*)&importer_data); | ||
|
|
||
| pthread_join(importer_thread, NULL); |
| * | ||
| * @param[in] data pointer to db_permanode_pool_t | ||
| * | ||
| * @return NULL |
Contributor
There was a problem hiding this comment.
There is no returning NULL here
| #include "scylladb_permanode.h" | ||
|
|
||
| #include "scylladb_permanode_thpool.h" | ||
| /** |
Contributor
There was a problem hiding this comment.
add a new line between line 15 and 16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The listener subscribes newly confirmed transactions from IRI and adds inserting tasks into the task queue of thread pool.
The importer reads confirmed transactions from historical transaction files dumped from IRI and adds inserting tasks into the task queue of thread pool.
Each worker in the thread pool establishes a session connected to ScyllaDB cluster and takes inserting tasks.