Release SegmentGroup reference count (#790)

In streaming ingestion, segment group is set to be one in creation.
Upon closing, reference count should to be released. Otherwise,
file descriptor and segment group object in memory can not be freed.
This commit is contained in:
lichaoyong
2019-03-22 14:17:05 +08:00
committed by ZHAO Chun
parent 4d8f0dc203
commit e60b71da8c

View File

@ -38,6 +38,9 @@ DeltaWriter::~DeltaWriter() {
if (!_delta_written_success) {
_garbage_collection();
}
for (SegmentGroup* segment_group : _segment_group_vec) {
segment_group->release();
}
SAFE_DELETE(_writer);
SAFE_DELETE(_mem_table);
SAFE_DELETE(_schema);
@ -47,14 +50,12 @@ void DeltaWriter::_garbage_collection() {
OLAPEngine::get_instance()->delete_transaction(_req.partition_id, _req.transaction_id,
_req.tablet_id, _req.schema_hash);
for (SegmentGroup* segment_group : _segment_group_vec) {
segment_group->release();
OLAPEngine::get_instance()->add_unused_index(segment_group);
}
if (_new_table != nullptr) {
OLAPEngine::get_instance()->delete_transaction(_req.partition_id, _req.transaction_id,
_new_table->tablet_id(), _new_table->schema_hash());
for (SegmentGroup* segment_group : _new_segment_group_vec) {
segment_group->release();
OLAPEngine::get_instance()->add_unused_index(segment_group);
}
}