@@ -101,6 +101,27 @@ const size_t BUFFER_SIZE = 1024 * 1024;
101101// Just 10^9.
102102static constexpr auto NS = 1000000000UL ;
103103
104+ static std::string normalize_benchmark_prefix (std::string_view raw_prefix) {
105+ std::string normalized {doris::trim (raw_prefix)};
106+ while (!normalized.empty () && normalized.front () == ' /' ) {
107+ normalized.erase (normalized.begin ());
108+ }
109+ while (!normalized.empty () && normalized.back () == ' /' ) {
110+ normalized.pop_back ();
111+ }
112+ return normalized;
113+ }
114+
115+ static std::string get_prefix () {
116+ std::string prefix = HIDDEN_PREFIX;
117+ std::string subdir = normalize_benchmark_prefix (doris::config::test_s3_prefix);
118+ if (!subdir.empty ()) {
119+ prefix += subdir;
120+ prefix += " /" ;
121+ }
122+ return prefix;
123+ }
124+
104125DEFINE_int32 (port, 8888 , " Http Port of this server" );
105126
106127static std::string build_info () {
@@ -487,7 +508,7 @@ std::string get_usage(const std::string& progname) {
487508 "read_iops": <limit>, // IOPS limit for reading per segment files
488509 "num_threads": <count>, // Number of threads in the thread pool, default 200
489510 "num_files": <count>, // Number of segments to write/read
490- "file_prefix": "<prefix>", // Prefix for segment files, Notice: this tools hide prefix( test_file_cache_microbench/) before file_prefix
511+ "file_prefix": "<prefix>", // Prefix for segment files, key prefix is test_file_cache_microbench/<test_s3_prefix>/
491512 "write_batch_size": <size>, // Size of data to write in each write operation
492513 "cache_type": <type>, // Write or Read data enter file cache queue type, support NORMAL | TTL | INDEX | DISPOSABLE, default NORMAL
493514 "expiration": <timestamp>, // File cache ttl expire time, value is a unix timestamp
@@ -720,7 +741,7 @@ struct JobConfig {
720741 " repeat: {}, expiration: {}, cache_type: {}, read_offset: [{}, {}), "
721742 " read_length: [{}, {})" ,
722743 size_bytes_perfile, write_iops, read_iops, num_threads, num_files,
723- HIDDEN_PREFIX + file_prefix, write_file_cache, write_batch_size, repeat, expiration,
744+ get_prefix () + file_prefix, write_file_cache, write_batch_size, repeat, expiration,
724745 cache_type, read_offset_left, read_offset_right, read_length_left,
725746 read_length_right);
726747 }
@@ -1280,7 +1301,7 @@ class JobManager {
12801301 // If it's a read-only job, find the previously written files
12811302 if (config.read_iops > 0 && config.write_iops == 0 ) {
12821303 std::string old_job_id =
1283- s3_file_records.find_job_id_by_prefix (HIDDEN_PREFIX + config.file_prefix );
1304+ s3_file_records.find_job_id_by_prefix (get_prefix () + config.file_prefix );
12841305 if (old_job_id.empty ()) {
12851306 throw std::runtime_error (
12861307 " Can't find previously job uploaded files. Please make sure read "
@@ -1293,7 +1314,7 @@ class JobManager {
12931314
12941315 // Generate file keys
12951316 for (int i = 0 ; i < config.num_files ; ++i) {
1296- keys.push_back (HIDDEN_PREFIX + config.file_prefix + " /" + rewrite_job_id + " _" +
1317+ keys.push_back (get_prefix () + config.file_prefix + " /" + rewrite_job_id + " _" +
12971318 std::to_string (i));
12981319 }
12991320
@@ -1424,7 +1445,7 @@ class JobManager {
14241445 auto start_time = std::chrono::steady_clock::now ();
14251446
14261447 int64_t exist_job_perfile_size = s3_file_records.get_exist_job_perfile_size_by_prefix (
1427- HIDDEN_PREFIX + config.file_prefix );
1448+ get_prefix () + config.file_prefix );
14281449 std::vector<std::future<void >> read_futures;
14291450 doris::io::IOContext io_ctx;
14301451 doris::io::FileCacheStatistics total_stats;
@@ -1447,7 +1468,7 @@ class JobManager {
14471468 std::vector<std::string> read_files;
14481469 if (exist_job_perfile_size != -1 ) {
14491470 // read exist files
1450- s3_file_records.get_exist_job_files_by_prefix (HIDDEN_PREFIX + config.file_prefix ,
1471+ s3_file_records.get_exist_job_files_by_prefix (get_prefix () + config.file_prefix ,
14511472 read_files, config.num_files );
14521473 }
14531474
@@ -2662,12 +2683,8 @@ int main(int argc, char* argv[]) {
26622683 };
26632684 periodiccally_log_thread = std::thread {periodiccally_log};
26642685
2665- try {
2666- HttpServer http_server;
2667- http_server.start (doris_home);
2668- } catch (const std::exception& e) {
2669- LOG (ERROR) << " Error in HTTP server: " << e.what ();
2670- }
2686+ HttpServer http_server;
2687+ http_server.start (doris_home);
26712688
26722689 if (periodiccally_log_thread.joinable ()) {
26732690 {
0 commit comments