mirror of
https://github.com/simon987/sist2.git
synced 2025-12-12 15:08:53 +00:00
only add new entries into new_table to save memory
This commit is contained in:
@@ -535,7 +535,7 @@ void incremental_copy(store_t *store, store_t *dst_store, const char *filepath,
|
||||
read_index(filepath, "", INDEX_TYPE_NDJSON, incremental_copy_handle_doc);
|
||||
}
|
||||
|
||||
void incremental_delete(const char *del_filepath, GHashTable *orig_table, GHashTable *new_table) {
|
||||
void incremental_delete(const char *del_filepath, GHashTable *orig_table, GHashTable *copy_table, GHashTable *new_table) {
|
||||
GHashTableIter iter;
|
||||
gpointer key, UNUSED(value);
|
||||
char path_md5[MD5_STR_LENGTH + 1];
|
||||
@@ -544,7 +544,8 @@ void incremental_delete(const char *del_filepath, GHashTable *orig_table, GHashT
|
||||
initialize_writer_ctx(del_filepath);
|
||||
g_hash_table_iter_init(&iter, orig_table);
|
||||
while(g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
if (NULL == g_hash_table_lookup(new_table, key)) {
|
||||
if (NULL == g_hash_table_lookup(new_table, key) &&
|
||||
NULL == g_hash_table_lookup(copy_table, key)) {
|
||||
memcpy(path_md5, key, MD5_STR_LENGTH - 1);
|
||||
zstd_write_string(path_md5, MD5_STR_LENGTH);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ typedef void(*index_func)(cJSON *, const char[MD5_STR_LENGTH]);
|
||||
void incremental_copy(store_t *store, store_t *dst_store, const char *filepath,
|
||||
const char *dst_filepath, GHashTable *copy_table);
|
||||
|
||||
void incremental_delete(const char *del_filepath, GHashTable *orig_table, GHashTable *new_table);
|
||||
void incremental_delete(const char *del_filepath, GHashTable *orig_table, GHashTable *copy_table, GHashTable *new_table);
|
||||
|
||||
void write_document(document_t *doc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user