Skip to content

Commit 37a39ad

Browse files
yiguoleilichaoyong
authored and
lichaoyong
committed
Olapsnapshot converter not set tablet uid correctly (#1178)
1 parent 9546ab0 commit 37a39ad

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

be/src/olap/olap_snapshot_converter.cpp

100644100755
+8-7
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,11 @@ OLAPStatus OlapSnapshotConverter::convert_to_rowset_meta(const PDelta& delta,
234234
*delete_condition = delta.delete_condition();
235235
}
236236
rowset_meta_pb->set_creation_time(delta.creation_time());
237-
VLOG(3) << "convert pending delta start_version = " << delta.start_version()
237+
LOG(INFO) << "convert visible delta start_version = " << delta.start_version()
238238
<< " end_version = " << delta.end_version()
239239
<< " version_hash = " << delta.version_hash()
240-
<< " to rowset id = " << rowset_id;
240+
<< " to rowset id = " << rowset_id
241+
<< " tablet_id = " << tablet_id;
241242
return OLAP_SUCCESS;
242243
}
243244

@@ -287,7 +288,7 @@ OLAPStatus OlapSnapshotConverter::convert_to_rowset_meta(const PPendingDelta& pe
287288
*delete_condition = pending_delta.delete_condition();
288289
}
289290
rowset_meta_pb->set_creation_time(pending_delta.creation_time());
290-
VLOG(3) << "convert pending delta txn id = " << pending_delta.transaction_id()
291+
LOG(INFO) << "convert pending delta txn id = " << pending_delta.transaction_id()
291292
<< " tablet_id = " << tablet_id
292293
<< " schema_hash = " << schema_hash
293294
<< " to rowset id = " << rowset_id;
@@ -403,8 +404,8 @@ OLAPStatus OlapSnapshotConverter::to_new_snapshot(const OLAPHeaderMessage& olap_
403404
// convert visible pdelta file to rowsets
404405
for (auto& visible_rowset : tablet_meta_pb->rs_metas()) {
405406
RowsetMetaSharedPtr alpha_rowset_meta(new AlphaRowsetMeta());
406-
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
407407
alpha_rowset_meta->init_from_pb(visible_rowset);
408+
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
408409
AlphaRowset rowset(&tablet_schema, new_data_path_prefix, &data_dir, alpha_rowset_meta);
409410
RETURN_NOT_OK(rowset.init());
410411
std::vector<std::string> success_files;
@@ -415,8 +416,8 @@ OLAPStatus OlapSnapshotConverter::to_new_snapshot(const OLAPHeaderMessage& olap_
415416
// convert inc delta file to rowsets
416417
for (auto& inc_rowset : tablet_meta_pb->inc_rs_metas()) {
417418
RowsetMetaSharedPtr alpha_rowset_meta(new AlphaRowsetMeta());
418-
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
419419
alpha_rowset_meta->init_from_pb(inc_rowset);
420+
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
420421
AlphaRowset rowset(&tablet_schema, new_data_path_prefix, &data_dir, alpha_rowset_meta);
421422
RETURN_NOT_OK(rowset.init());
422423
std::vector<std::string> success_files;
@@ -429,11 +430,11 @@ OLAPStatus OlapSnapshotConverter::to_new_snapshot(const OLAPHeaderMessage& olap_
429430
RETURN_NOT_OK(rowset.convert_from_old_files(inc_data_path, &success_files));
430431
_modify_old_segment_group_id(const_cast<RowsetMetaPB&>(inc_rowset));
431432
}
432-
433+
433434
for (auto it = pending_rowsets->begin(); it != pending_rowsets->end(); ++it) {
434435
RowsetMetaSharedPtr alpha_rowset_meta(new AlphaRowsetMeta());
435-
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
436436
alpha_rowset_meta->init_from_pb(*it);
437+
alpha_rowset_meta->set_tablet_uid(tablet_meta_pb->tablet_uid());
437438
AlphaRowset rowset(&tablet_schema, new_data_path_prefix, &data_dir, alpha_rowset_meta);
438439
RETURN_NOT_OK(rowset.init());
439440
std::vector<std::string> success_files;

be/test/olap/olap_snapshot_converter_test.cpp

100644100755
+3-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ TEST_F(OlapSnapshotConverterTest, ToNewAndToOldSnapshot) {
187187
bool found = false;
188188
for (auto& pending_rowset : pending_rowsets) {
189189
if (pending_rowset.partition_id() == partition_id
190-
&& pending_rowset.txn_id() == transaction_id) {
190+
&& pending_rowset.txn_id() == transaction_id
191+
&& pending_rowset.tablet_uid().hi() == tablet_meta_pb.tablet_uid().hi()
192+
&& pending_rowset.tablet_uid().lo() == tablet_meta_pb.tablet_uid().lo()) {
191193
found = true;
192194
}
193195
}

0 commit comments

Comments
 (0)