feat(lsm): remove data file when removing entry
parent
c8728f2371
commit
a4ad8c246e
|
@ -147,5 +147,24 @@ lsm_error lsm_entry_disk_remove(lsm_entry_handle *handle) {
|
|||
|
||||
pthread_mutex_unlock(&store->idx.lock);
|
||||
|
||||
if (res != lsm_error_ok) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// Remove data file if present
|
||||
if (entry->data_len > 0) {
|
||||
if (handle->f != NULL) {
|
||||
fclose(handle->f);
|
||||
handle->f = NULL;
|
||||
}
|
||||
|
||||
char data_path[lsm_entry_data_path_len(handle) + 1];
|
||||
lsm_entry_data_path(data_path, handle);
|
||||
|
||||
if (remove(data_path) != 0) {
|
||||
return lsm_error_failed_io;
|
||||
}
|
||||
}
|
||||
|
||||
return lsm_error_ok;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue