MCPcopy Create free account
hub / github.com/ByConity/ByConity / getRelativePathForPrefix

Method getRelativePathForPrefix

src/Storages/MergeTree/IMergeTreeDataPart.cpp:1716–1736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1714}
1715
1716String IMergeTreeDataPart::getRelativePathForPrefix(const String & prefix, bool is_detach) const
1717{
1718 String res;
1719
1720 /** If you need to detach a part, and directory into which we want to rename it already exists,
1721 * we will rename to the directory with the name to which the suffix is added in the form of "_tryN".
1722 * This is done only in the case of `to_detached`, because it is assumed that in this case the exact name does not matter.
1723 * No more than 10 attempts are made so that there are not too many junk directories left.
1724 */
1725 for (int try_no = 0; try_no < 10; try_no++)
1726 {
1727 res = (is_detach ? "detached/" : "") + (prefix.empty() ? "" : prefix + "_") + info.getPartNameWithHintMutation() + (try_no ? "_try" + DB::toString(try_no) : "");
1728
1729 if (!volume->getDisk()->exists(fs::path(storage.getRelativeDataPath(location)) / res))
1730 return res;
1731
1732 LOG_WARNING(storage.log, "Directory {} (to detach to) already exists. Will detach to directory with '_tryN' suffix.", res);
1733 }
1734
1735 return res;
1736}
1737
1738void IMergeTreeDataPart::setDeleteBitmapMeta(DeleteBitmapMetaPtr bitmap_meta, bool force_set) const
1739{

Callers 1

Calls 5

toStringFunction · 0.70
emptyMethod · 0.45
existsMethod · 0.45
getDiskMethod · 0.45

Tested by

no test coverage detected