Skip to content

Commit 41e0212

Browse files
Merge pull request ClickHouse#87502 from ClickHouse/backport/25.8/87463
Backport ClickHouse#87463 to 25.8: EmbeddedRocksDB: Go back to using data/ path by default
2 parents 9f9e607 + d6ff78f commit 41e0212

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Storages/RocksDB/StorageEmbeddedRocksDB.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,8 @@ StorageEmbeddedRocksDB::StorageEmbeddedRocksDB(const StorageID & table_id_,
214214

215215
if (rocksdb_dir.empty())
216216
{
217-
/// We used to create databases under the database directory by default instead of user files. Check first if it exists there
218-
auto old_path = context_->getPath() + relative_data_path_;
219-
if (mode >= LoadingStrictnessLevel::ATTACH && fs::exists(old_path))
220-
rocksdb_dir = old_path;
221-
else
222-
rocksdb_dir = fs::path{getContext()->getUserFilesPath()} / relative_data_path_;
217+
/// We create tables under the database directory by default and enforce user_files path check for explicitly declared paths
218+
rocksdb_dir = context_->getPath() + relative_data_path_;
223219
}
224220
else
225221
{
@@ -229,7 +225,7 @@ StorageEmbeddedRocksDB::StorageEmbeddedRocksDB(const StorageID & table_id_,
229225
rocksdb_dir = user_files_path / rocksdb_dir;
230226
rocksdb_dir = fs::absolute(rocksdb_dir).lexically_normal();
231227

232-
if (!is_local && !pathStartsWith(fs::path(rocksdb_dir), user_files_path))
228+
if (!is_local && !fileOrSymlinkPathStartsWith(fs::path(rocksdb_dir), user_files_path))
233229
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Path must be inside user-files path: {}", user_files_path.string());
234230
}
235231

0 commit comments

Comments
 (0)