Skip to content

Commit c0a099c

Browse files
authored
Merge branch 'dev' into yt/sc-48774/fragment_list_consolidation
2 parents 3ab70bd + aef8f9b commit c0a099c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1652
-304
lines changed

format_spec/array_schema.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ The array schema file consists of a single [generic tile](./generic_tile.md), wi
5454
| Label 1 | [Dimension Label](#dimension_label) | First dimension label |
5555
||||
5656
| Label N | [Dimension Label](#dimension_label) | Nth dimension label |
57+
| Num enumerations | `uint32_t` | Number of [enumerations](./enumeration.md) in the array |
58+
| Enumeration name length 1 | `uint32_t` | The number of characters in the enumeration 1 name |
59+
| Enumeration name 1 | `uint8_t[]` | The name of enumeration 1 |
60+
| Enumeration filename length 1 | `uint32_t` | The number of characters in the enumeration 1 file |
61+
| Enumeration filename 1 | `uint8_t[]` | The name of the file in the `__enumerations` subdirectory that conatins enumeration 1's data |
62+
| Enumeration name length N | `uint32_t` | The number of characters in the enumeration N name |
63+
| Enumeration name N | `uint8_t[]` | The name of enumeration N |
64+
| Enumeration filename length N | `uint32_t` | The number of characters in the enumeration N file |
65+
| Enumeration filename N | `uint8_t[]` | The name of the file in the `__enumerations` subdirectory that conatins enumeration N's data |
5766
| CurrentDomain | [CurrentDomain](./current_domain.md) | The array current domain |
5867

5968
## Domain

test/src/unit-Reader.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ TEST_CASE_METHOD(
158158
uint64_t tmp_size = 0;
159159
Config config;
160160
Context context(config);
161+
LocalQueryStateMachine lq_state_machine{LocalQueryState::uninitialized};
161162
std::unordered_map<std::string, tiledb::sm::QueryBuffer> buffers;
162163
buffers.emplace(
163164
"a", tiledb::sm::QueryBuffer(nullptr, nullptr, &tmp_size, &tmp_size));
@@ -173,7 +174,8 @@ TEST_CASE_METHOD(
173174
context.resources(),
174175
array.memory_tracker(),
175176
tracker_,
176-
context.storage_manager(),
177+
lq_state_machine,
178+
CancellationSource(context.storage_manager()),
177179
array.opened_array(),
178180
config,
179181
nullopt,

test/src/unit-capi-incomplete.cc

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ void IncompleteFx::check_sparse_unsplittable_complete() {
11451145
TEST_CASE_METHOD(
11461146
IncompleteFx,
11471147
"C API: Test incomplete read queries, dense",
1148-
"[capi][incomplete][dense-incomplete][serialization][rest]") {
1148+
"[capi][incomplete][dense-incomplete][rest]") {
11491149
create_dense_array();
11501150
write_dense_full();
11511151
check_dense_incomplete();
@@ -1159,7 +1159,7 @@ TEST_CASE_METHOD(
11591159
TEST_CASE_METHOD(
11601160
IncompleteFx,
11611161
"C API: Test incomplete read queries, sparse",
1162-
"[capi][incomplete][sparse][serialization][rest]") {
1162+
"[capi][incomplete][sparse][rest]") {
11631163
create_sparse_array();
11641164
write_sparse_full();
11651165
check_sparse_incomplete();
@@ -1171,8 +1171,47 @@ TEST_CASE_METHOD(
11711171
TEST_CASE_METHOD(
11721172
IncompleteFx,
11731173
"C API: Test incomplete read queries, dense, serialized",
1174-
"[capi][incomplete][dense][serialization][rest]") {
1174+
"[capi][incomplete][dense][rest]") {
11751175
create_dense_array();
11761176
write_dense_full();
11771177
check_dense_incomplete();
11781178
}
1179+
1180+
TEST_CASE_METHOD(
1181+
IncompleteFx,
1182+
"C API: Test incomplete read queries, sparse",
1183+
"[capi][incomplete][sparse][retries][sc-49128][rest]") {
1184+
// This test is testing CURL logic and only makes sense on REST-CI
1185+
if (!vfs_test_setup_.is_rest()) {
1186+
return;
1187+
}
1188+
1189+
// Force retries on successful requests to test that the buffers
1190+
// resetting in the retry logic works well
1191+
tiledb_config_t* cfg;
1192+
tiledb_error_t* err = nullptr;
1193+
int rc = tiledb_config_alloc(&cfg, &err);
1194+
REQUIRE(rc == TILEDB_OK);
1195+
REQUIRE(err == nullptr);
1196+
rc = tiledb_config_set(cfg, "rest.retry_http_codes", "200", &err);
1197+
REQUIRE(rc == TILEDB_OK);
1198+
REQUIRE(err == nullptr);
1199+
rc = tiledb_config_set(cfg, "rest.retry_count", "1", &err);
1200+
REQUIRE(rc == TILEDB_OK);
1201+
REQUIRE(err == nullptr);
1202+
rc = tiledb_config_set(cfg, "rest.retry_initial_delay_ms", "5", &err);
1203+
REQUIRE(rc == TILEDB_OK);
1204+
REQUIRE(err == nullptr);
1205+
1206+
// Update the context with config
1207+
vfs_test_setup_.update_config(cfg);
1208+
ctx_ = vfs_test_setup_.ctx_c;
1209+
tiledb_config_free(&cfg);
1210+
1211+
create_sparse_array();
1212+
write_sparse_full();
1213+
check_sparse_incomplete();
1214+
check_sparse_until_complete();
1215+
check_sparse_unsplittable_overflow();
1216+
check_sparse_unsplittable_complete();
1217+
}

test/src/unit-curl.cc

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343

4444
using namespace tiledb::sm;
4545

46-
TEST_CASE("CURL: Test curl's header parsing callback", "[curl]") {
46+
TEST_CASE(
47+
"CURL: Test curl's header parsing callback", "[curl][redirect-caching]") {
4748
// Initialize data that in real life scenario would be initialized by
4849
// RestClient
4950
char res_data[] =
@@ -58,6 +59,7 @@ TEST_CASE("CURL: Test curl's header parsing callback", "[curl]") {
5859
std::unordered_map<std::string, std::string> redirect_meta_;
5960
userdata.redirect_uri_map = &redirect_meta_;
6061
userdata.redirect_uri_map_lock = &redirect_mtx_;
62+
userdata.should_cache_redirect = true;
6163

6264
size_t result = write_header_callback(&res_data, size, count, &userdata);
6365

@@ -94,6 +96,35 @@ TEST_CASE("CURL: Test curl's header parsing callback", "[curl]") {
9496
"tiledb://my_username");
9597
}
9698

99+
TEST_CASE(
100+
"CURL: Test curl is not caching the region when requested so",
101+
"[curl][redirect-caching]") {
102+
// Initialize data that in real life scenario would be initialized by
103+
// RestClient
104+
char res_data[] =
105+
"Location: https://test.url.domain/v1/arrays/testns/test_arr";
106+
size_t size = 1;
107+
size_t count = sizeof(res_data);
108+
109+
HeaderCbData userdata;
110+
std::string ns_array = "testns:test_arr";
111+
userdata.uri = &ns_array;
112+
std::mutex redirect_mtx_;
113+
std::unordered_map<std::string, std::string> redirect_meta_;
114+
userdata.redirect_uri_map = &redirect_meta_;
115+
userdata.redirect_uri_map_lock = &redirect_mtx_;
116+
userdata.should_cache_redirect = false;
117+
118+
size_t result = write_header_callback(&res_data, size, count, &userdata);
119+
120+
// The return value should be equal to size * count
121+
CHECK(result == size * count);
122+
// The uri is not mutated inside the callback function
123+
CHECK(*userdata.uri == ns_array);
124+
// The redirect map holds a record of ns_array key and redirection url value
125+
CHECK(userdata.redirect_uri_map->count(ns_array) == 0);
126+
}
127+
97128
TEST_CASE(
98129
"RestClient: Remove trailing slash from rest_server_", "[rest-client]") {
99130
std::string rest_server =

test/src/unit-enumerations.cc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,10 +2398,18 @@ TEST_CASE_METHOD(
23982398
auto qc1 = create_qc("attr1", (int)2, QueryConditionOp::EQ);
23992399
qc1.set_use_enumeration(false);
24002400

2401-
Query q1(ctx_.resources(), ctx_.storage_manager(), array);
2401+
Query q1(
2402+
ctx_.resources(),
2403+
ctx_.cancellation_source(),
2404+
ctx_.storage_manager(),
2405+
array);
24022406
throw_if_not_ok(q1.set_condition(qc1));
24032407

2404-
Query q2(ctx_.resources(), ctx_.storage_manager(), array);
2408+
Query q2(
2409+
ctx_.resources(),
2410+
ctx_.cancellation_source(),
2411+
ctx_.storage_manager(),
2412+
array);
24052413
ser_des_query(&q1, &q2, client_side, ser_type);
24062414

24072415
auto qc2 = q2.condition();
@@ -2434,10 +2442,18 @@ TEST_CASE_METHOD(
24342442

24352443
throw_if_not_ok(qc1.combine(qc2, QueryConditionCombinationOp::OR, &qc3));
24362444

2437-
Query q1(ctx_.resources(), ctx_.storage_manager(), array);
2445+
Query q1(
2446+
ctx_.resources(),
2447+
ctx_.cancellation_source(),
2448+
ctx_.storage_manager(),
2449+
array);
24382450
throw_if_not_ok(q1.set_condition(qc3));
24392451

2440-
Query q2(ctx_.resources(), ctx_.storage_manager(), array);
2452+
Query q2(
2453+
ctx_.resources(),
2454+
ctx_.cancellation_source(),
2455+
ctx_.storage_manager(),
2456+
array);
24412457
ser_des_query(&q1, &q2, client_side, ser_type);
24422458

24432459
auto qc4 = q2.condition();

tiledb/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ set(TILEDB_CORE_SOURCES
259259
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/query.cc
260260
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/query_condition.cc
261261
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/query_remote_buffer_storage.cc
262+
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/query_state.cc
262263
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/readers/aggregators/count_aggregator.cc
263264
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/readers/aggregators/min_max_aggregator.cc
264265
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/query/readers/aggregators/operation.cc
@@ -300,6 +301,7 @@ set(TILEDB_CORE_SOURCES
300301
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/vacuum.cc
301302
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/stats/global_stats.cc
302303
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/stats/stats.cc
304+
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/storage_manager/cancellation_source.cc
303305
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/storage_manager/context.cc
304306
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/storage_manager/context_resources.cc
305307
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/storage_manager/storage_manager.cc

tiledb/api/c_api/context/context_api_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "../../c_api_support/handle/handle.h"
3737
#include "../config/config_api_internal.h"
3838
#include "../error/error_api_internal.h"
39+
#include "tiledb/sm/storage_manager/cancellation_source.h"
3940
#include "tiledb/sm/storage_manager/context.h"
4041

4142
struct tiledb_ctx_handle_t
@@ -71,6 +72,10 @@ struct tiledb_ctx_handle_t
7172
return ctx_.storage_manager();
7273
}
7374

75+
inline tiledb::sm::CancellationSource cancellation_source() {
76+
return ctx_.cancellation_source();
77+
}
78+
7479
inline tiledb::sm::RestClient& rest_client() {
7580
return ctx_.rest_client();
7681
}

tiledb/common/memory_tracker.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ std::string memory_type_to_str(MemoryType type) {
5454
return "Attributes";
5555
case MemoryType::CONSOLIDATION_BUFFERS:
5656
return "ConsolidationBuffers";
57+
case MemoryType::DENSE_TILE_SUBARRAY:
58+
return "DenseTileSubarray";
5759
case MemoryType::DIMENSION_LABELS:
5860
return "DimensionLabels";
5961
case MemoryType::DIMENSIONS:

tiledb/common/memory_tracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ namespace tiledb::sm {
110110
enum class MemoryType {
111111
ATTRIBUTES,
112112
CONSOLIDATION_BUFFERS,
113+
DENSE_TILE_SUBARRAY,
113114
DIMENSION_LABELS,
114115
DIMENSIONS,
115116
DOMAINS,

tiledb/sm/array/CMakeLists.txt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,8 @@ include(object_library)
3535
#
3636
# This design eliminates cyclic dependencies in the build, as each module has
3737
# its own dependency chain.
38-
#
39-
# Note that neither object library has been implemented at present. Rather,
40-
# class `Array` is getting segregated by functionality to prepare for this
41-
# future work.
42-
#
43-
# Though there is currently an object library named `array`, it will soon be
44-
# aptly renamed `array_directory`.
45-
#
46-
# The `array` object library will be added in the near future.
4738
#
48-
# The `array_operations` object library is very specifically blocked by
39+
# Note: The `array_operations` object library is very specifically blocked by
4940
# `StrategyBase::throw_if_cancelled`. At present, this function relies on
5041
# `StorageManagerCanonical`, which is slated for removal. The `Query` class is
5142
# undergoing maintenance to remove all dependencies on class `StorageManager`.
@@ -54,15 +45,15 @@ include(object_library)
5445
#
5546

5647
#
57-
# `array` object library
48+
# `array_directory` object library
5849
#
59-
commence(object_library array)
50+
commence(object_library array_directory)
6051
this_target_sources(array_directory.cc)
6152
this_target_object_libraries(
6253
array_schema
6354
baseline
6455
context_resources
65-
fragment
56+
fragment_identifier
6657
generic_tile_io
6758
vfs
6859
)
@@ -71,4 +62,18 @@ commence(object_library array)
7162
endif()
7263
conclude(object_library)
7364

65+
#
66+
# `array` object library
67+
#
68+
commence(object_library array)
69+
this_target_sources(array.cc consistency.cc)
70+
this_target_object_libraries(
71+
array_directory
72+
array_schema_operations
73+
fragment_metadata
74+
metadata
75+
object
76+
)
77+
conclude(object_library)
78+
7479
add_test_subdirectory()

0 commit comments

Comments
 (0)