Skip to content

Commit fa81315

Browse files
committed
fix possible segfault
1 parent 3c1bd5d commit fa81315

1 file changed

Lines changed: 30 additions & 13 deletions

File tree

src/Storages/System/StorageSystemTables.cpp

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -608,18 +608,27 @@ class TablesBlockSource : public ISource
608608
if (columns_mask[src_index++])
609609
{
610610
bool inserted = false;
611-
// Extract from specific DataLake metadata if suitable
612-
if (auto * obj = dynamic_cast<StorageObjectStorage *>(table.get()))
611+
612+
try
613613
{
614-
if (auto * dl_meta = obj->getExternalMetadata(context))
614+
// Extract from specific DataLake metadata if suitable
615+
if (auto * obj = dynamic_cast<StorageObjectStorage *>(table.get()))
615616
{
616-
if (auto p = dl_meta->partitionKey(context); p.has_value())
617+
if (auto * dl_meta = obj->getExternalMetadata(context))
617618
{
618-
res_columns[res_index++]->insert(*p);
619-
inserted = true;
619+
if (auto p = dl_meta->partitionKey(context); p.has_value())
620+
{
621+
res_columns[res_index++]->insert(*p);
622+
inserted = true;
623+
}
620624
}
621-
}
622625

626+
}
627+
}
628+
catch (const Exception &)
629+
{
630+
/// Failed to get info. It's not critical, just log it.
631+
tryLogCurrentException("StorageSystemTables");
623632
}
624633

625634
if (!inserted)
@@ -635,18 +644,26 @@ class TablesBlockSource : public ISource
635644
{
636645
bool inserted = false;
637646

638-
// Extract from specific DataLake metadata if suitable
639-
if (auto * obj = dynamic_cast<StorageObjectStorage *>(table.get()))
647+
try
640648
{
641-
if (auto * dl_meta = obj->getExternalMetadata(context))
649+
// Extract from specific DataLake metadata if suitable
650+
if (auto * obj = dynamic_cast<StorageObjectStorage *>(table.get()))
642651
{
643-
if (auto p = dl_meta->sortingKey(context); p.has_value())
652+
if (auto * dl_meta = obj->getExternalMetadata(context))
644653
{
645-
res_columns[res_index++]->insert(*p);
646-
inserted = true;
654+
if (auto p = dl_meta->sortingKey(context); p.has_value())
655+
{
656+
res_columns[res_index++]->insert(*p);
657+
inserted = true;
658+
}
647659
}
648660
}
649661
}
662+
catch (const Exception &)
663+
{
664+
/// Failed to get info. It's not critical, just log it.
665+
tryLogCurrentException("StorageSystemTables");
666+
}
650667

651668
if (!inserted)
652669
{

0 commit comments

Comments
 (0)