@@ -156,12 +156,12 @@ class PackageReader : public td::actor::Actor {
156156 std::shared_ptr<PackageStatistics> statistics_;
157157};
158158
159- static std::string get_package_file_name (PackageId p_id, ShardIdFull shard_prefix) {
159+ static std::string get_package_file_name (PackageId p_id, ShardIdFull shard_prefix, bool legacy = false ) {
160160 td::StringBuilder sb;
161161 sb << p_id.name ();
162162 if (!shard_prefix.is_masterchain ()) {
163163 sb << " ." ;
164- sb << shard_prefix.workchain << " :" << shard_to_str (shard_prefix.shard );
164+ sb << shard_prefix.workchain << (legacy ? " :" : " _ " ) << shard_to_str (shard_prefix.shard );
165165 }
166166 sb << " .pack" ;
167167 return sb.as_cslice ().str ();
@@ -833,7 +833,13 @@ td::Result<ArchiveSlice::PackageInfo *> ArchiveSlice::choose_package(BlockSeqno
833833
834834void ArchiveSlice::add_package (td::uint32 seqno, ShardIdFull shard_prefix, td::uint64 size, td::uint32 version) {
835835 PackageId p_id{seqno, key_blocks_only_, temp_};
836- std::string path = PSTRING () << db_root_ << p_id.path () << get_package_file_name (p_id, shard_prefix);
836+ std::string path_legacy = PSTRING () << db_root_ << p_id.path () << get_package_file_name (p_id, shard_prefix, true );
837+ std::string path;
838+ if (td::stat (path_legacy).is_ok ()) {
839+ path = std::move (path_legacy);
840+ } else {
841+ path = PSTRING () << db_root_ << p_id.path () << get_package_file_name (p_id, shard_prefix);
842+ }
837843 auto R = Package::open (path, false , true );
838844 if (R.is_error ()) {
839845 LOG (FATAL) << " failed to open/create archive '" << path << " ': " << R.move_as_error ();
0 commit comments