| 1714 | } |
| 1715 | |
| 1716 | String 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 | |
| 1738 | void IMergeTreeDataPart::setDeleteBitmapMeta(DeleteBitmapMetaPtr bitmap_meta, bool force_set) const |
| 1739 | { |
no test coverage detected