Skip to content

Commit 4e7b978

Browse files
authored
Remove uuid in favor of random_label (#4589)
Remove uuid in favor of random_label --- TYPE: IMPROVEMENT DESC: Remove uuid in favor of random_label
1 parent d227c22 commit 4e7b978

21 files changed

+35
-417
lines changed

test/src/unit-capi-vfs.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ TEST_CASE("C API: Test virtual filesystem", "[capi][vfs]") {
145145
std::string s3_bucket;
146146
if (s3_enabled) {
147147
SECTION("Filesystem: S3") {
148-
path = "s3://" + random_label("tiledb-") + "/tiledb_test/";
148+
path = "s3://tiledb-" + random_label() + "/tiledb_test/";
149149
s3_bucket = path.substr(0, path.find("tiledb_test/"));
150150

151151
// Check S3 bucket functionality
@@ -171,7 +171,7 @@ TEST_CASE("C API: Test virtual filesystem", "[capi][vfs]") {
171171
/** Note: Azure testing not currently enabled.
172172
if (azure_enabled) {
173173
SECTION("Filesystem: Azure") {
174-
path = "azure://" + random_label("tiledb-") + "/tiledb_test/";
174+
path = "azure://tiledb-" + random_label() + "/tiledb_test/";
175175
}
176176
} */
177177

@@ -403,7 +403,7 @@ TEST_CASE("C API: Test virtual filesystem", "[capi][vfs]") {
403403

404404
// Move from one bucket to another (only for S3)
405405
if (backend_is_s3) {
406-
std::string bucket2 = "s3://" + random_label("tiledb-") + "/";
406+
std::string bucket2 = "s3://tiledb-" + random_label() + "/";
407407
std::string subdir3 = bucket2 + "tiledb_test/subdir3/";
408408

409409
// Remove and recreate bucket if already exists
@@ -481,7 +481,7 @@ TEST_CASE("C API: Test virtual filesystem", "[capi][vfs]") {
481481

482482
// Copy from one bucket to another (only for S3)
483483
if (backend_is_s3) {
484-
std::string bucket2 = "s3://" + random_label("tiledb-") + "/";
484+
std::string bucket2 = "s3://tiledb-" + random_label() + "/";
485485
std::string subdir3 = bucket2 + "tiledb_test/subdir3/";
486486

487487
// Remove and recreate bucket if already exists

test/src/unit-cppapi-array.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ TEST_CASE("C++ API: Array write and read from MemFS", "[cppapi][memfs]") {
18831883
TEST_CASE(
18841884
"C++ API: Array on s3 with empty subfolders",
18851885
"[cppapi][s3][empty_subfolders]") {
1886-
const std::string array_bucket = "s3://" + random_label("tiledb-") + "/";
1886+
const std::string array_bucket = "s3://tiledb-" + random_label() + "/";
18871887
const std::string array_name = array_bucket + "cpp_unit_array/";
18881888

18891889
tiledb::Config cfg;

test/src/unit-cppapi-vfs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ TEST_CASE(
479479
tiledb_ctx_is_supported_fs(ctx.ptr().get(), TILEDB_S3, &s3) == TILEDB_OK);
480480
if (s3) {
481481
tiledb::VFS vfs(ctx);
482-
std::string bucket_name = "s3://" + random_label("tiledb-") + "/";
482+
std::string bucket_name = "s3://tiledb-" + random_label() + "/";
483483
if (vfs.is_bucket(bucket_name)) {
484484
REQUIRE_NOTHROW(vfs.remove_bucket(bucket_name));
485485
}

test/src/unit-s3-no-multipart.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct S3DirectFx {
5454

5555
const std::string S3_PREFIX = "s3://";
5656
const tiledb::sm::URI S3_BUCKET =
57-
tiledb::sm::URI(S3_PREFIX + random_label("tiledb-") + "/");
57+
tiledb::sm::URI(S3_PREFIX + "tiledb-" + random_label() + "/");
5858
const std::string TEST_DIR = S3_BUCKET.to_string() + "tiledb_test_dir/";
5959
ThreadPool thread_pool_{2};
6060
tiledb::sm::S3 s3_{&g_helper_stats, &thread_pool_, set_config_params()};

test/src/unit-s3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct S3Fx {
5555

5656
const std::string S3_PREFIX = "s3://";
5757
const tiledb::sm::URI S3_BUCKET =
58-
tiledb::sm::URI(S3_PREFIX + random_label("tiledb-") + "/");
58+
tiledb::sm::URI(S3_PREFIX + "tiledb-" + random_label() + "/");
5959
const std::string TEST_DIR = S3_BUCKET.to_string() + "tiledb_test_dir/";
6060
ThreadPool thread_pool_{2};
6161
tiledb::sm::S3 s3_{&g_helper_stats, &thread_pool_, set_config_params()};

test/src/unit-vfs.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ TEST_CASE("VFS: URI semantics", "[vfs][uri]") {
155155
REQUIRE(config.set("vfs.s3.verify_ssl", "false").ok());
156156

157157
root_pairs.emplace_back(
158-
URI("s3://" + random_label("vfs-") + "/"), std::move(config));
158+
URI("s3://vfs-" + random_label() + "/"), std::move(config));
159159
}
160160
if constexpr (tiledb::sm::filesystem::hdfs_enabled) {
161161
Config config;
162162
root_pairs.emplace_back(
163-
URI("hdfs:///" + random_label("vfs-") + "/"), std::move(config));
163+
URI("hdfs:///vfs-" + random_label() + "/"), std::move(config));
164164
}
165165
if constexpr (tiledb::sm::filesystem::azure_enabled) {
166166
Config config;
@@ -180,17 +180,17 @@ TEST_CASE("VFS: URI semantics", "[vfs][uri]") {
180180
.ok());
181181

182182
root_pairs.emplace_back(
183-
URI("azure://" + random_label("vfs-") + "/"), std::move(config));
183+
URI("azure://vfs-" + random_label() + "/"), std::move(config));
184184
}
185185

186186
Config config;
187187
#ifdef _WIN32
188188
root_pairs.emplace_back(
189-
URI(tiledb::sm::Win::current_dir() + "\\" + random_label("vfs-") + "\\"),
189+
URI(tiledb::sm::Win::current_dir() + "\\vfs-" + random_label() + "\\"),
190190
std::move(config));
191191
#else
192192
root_pairs.emplace_back(
193-
URI(Posix::current_dir() + "/" + random_label("vfs-") + "/"),
193+
URI(Posix::current_dir() + "/vfs-" + random_label() + "/"),
194194
std::move(config));
195195
#endif
196196

test/support/src/vfs_helpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class SupportedFsS3 : public SupportedFs {
159159
public:
160160
SupportedFsS3()
161161
: s3_prefix_("s3://")
162-
, s3_bucket_(s3_prefix_ + random_label("tiledb-") + "/")
162+
, s3_bucket_(s3_prefix_ + "tiledb-" + random_label() + "/")
163163
, temp_dir_(s3_bucket_ + "tiledb_test/") {
164164
}
165165

@@ -286,7 +286,7 @@ class SupportedFsAzure : public SupportedFs {
286286
public:
287287
SupportedFsAzure()
288288
: azure_prefix_("azure://")
289-
, container_(azure_prefix_ + random_label("tiledb-") + "/")
289+
, container_(azure_prefix_ + "tiledb-" + random_label() + "/")
290290
, temp_dir_(container_ + "tiledb_test/") {
291291
}
292292

@@ -353,7 +353,7 @@ class SupportedFsGCS : public SupportedFs {
353353
public:
354354
SupportedFsGCS(std::string prefix = "gcs://")
355355
: prefix_(prefix)
356-
, bucket_(prefix_ + random_label("tiledb-") + "/")
356+
, bucket_(prefix_ + "tiledb-" + random_label() + "/")
357357
, temp_dir_(bucket_ + "tiledb_test/") {
358358
}
359359

tiledb/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ set(TILEDB_CORE_SOURCES
243243
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/misc/tdb_time.cc
244244
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/misc/types.cc
245245
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/misc/utils.cc
246-
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/misc/uuid.cc
247246
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/misc/win_constants.cc
248247
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/ast/query_ast.cc
249248
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/deletes_and_updates/deletes_and_updates.cc

tiledb/common/random/random_label.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace tiledb::common {
4646
* values to be precisely a 32-digit hexadecimal value. Each value is padded
4747
* with 0s such that it makes up one 16-digit half of the full 32-digit number.
4848
*/
49-
std::string random_label(std::string prefix) {
49+
std::string random_label() {
5050
PRNG& prng = PRNG::get();
5151
std::stringstream ss;
5252

@@ -57,7 +57,7 @@ std::string random_label(std::string prefix) {
5757
ss << std::hex << std::setw(16) << std::setfill('0') << rand2;
5858

5959
// Return label string
60-
return prefix + ss.str();
60+
return ss.str();
6161
}
6262

6363
} // namespace tiledb::common

tiledb/common/random/random_label.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,15 @@
3838
namespace tiledb::common {
3939

4040
/**
41-
* Returns a PRNG-generated random label with the optionally-provided prefix.
42-
*
43-
* Given prefix "tiledb-", this function will return a label with syntax
44-
* tiledb-<32-digit hexadecimal random number>.
45-
* (Ex. tiledb-f258d22d4db9139204eef2b4b5d860cc).
41+
* Returns a PRNG-generated label as a 32-digit hexadecimal random number.
42+
* (Ex. f258d22d4db9139204eef2b4b5d860cc).
4643
*
4744
* Note: the random number is actually the combination of two 16-digit numbers.
4845
* The values are 0-padded to ensure exactly a 128-bit, 32-digit length.
4946
*
50-
* @param prefix The optional prefix of the label.
5147
* @return A random label.
5248
*/
53-
std::string random_label(std::string prefix = "");
49+
std::string random_label();
5450

5551
} // namespace tiledb::common
5652

0 commit comments

Comments
 (0)