From 7f7fa1d213dbe346f4976de000ec9414bf66e703 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Mon, 22 Jul 2024 14:22:18 -0400 Subject: [PATCH] Fix CI. --- .../cpp-integration-rest-schema-evolution.cc | 1 + test/src/unit-capi-config.cc | 2 +- test/src/unit-request-handlers.cc | 33 +++++++++++-------- tiledb/api/c_api/config/config_api_external.h | 4 +++ tiledb/sm/array_schema/CMakeLists.txt | 2 +- tiledb/sm/config/config.cc | 2 +- tiledb/sm/cpp_api/config.h | 2 +- tiledb/sm/serialization/array_schema.cc | 2 +- 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/test/src/cpp-integration-rest-schema-evolution.cc b/test/src/cpp-integration-rest-schema-evolution.cc index 830ac714d784..bb938f5d5b2b 100644 --- a/test/src/cpp-integration-rest-schema-evolution.cc +++ b/test/src/cpp-integration-rest-schema-evolution.cc @@ -37,6 +37,7 @@ #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/rest/rest_client.h" +#include #include using namespace tiledb; diff --git a/test/src/unit-capi-config.cc b/test/src/unit-capi-config.cc index 91bd1a5d6483..d943787a4cec 100644 --- a/test/src/unit-capi-config.cc +++ b/test/src/unit-capi-config.cc @@ -230,7 +230,7 @@ void check_save_to_file() { ss << "rest.curl.buffer_size 524288\n"; ss << "rest.curl.verbose false\n"; ss << "rest.http_compressor any\n"; - ss << "rest.load_enumerations_on_array_open true\n"; + ss << "rest.load_enumerations_on_array_open false\n"; ss << "rest.load_metadata_on_array_open true\n"; ss << "rest.load_non_empty_domain_on_array_open true\n"; ss << "rest.retry_count 25\n"; diff --git a/test/src/unit-request-handlers.cc b/test/src/unit-request-handlers.cc index 1adad90eb762..e5f37312d928 100644 --- a/test/src/unit-request-handlers.cc +++ b/test/src/unit-request-handlers.cc @@ -126,11 +126,10 @@ struct HandleConsolidationPlanRequestFx : RequestHandlerFx { TEST_CASE_METHOD( HandleLoadArraySchemaRequestFx, "tiledb_handle_load_array_schema_request - no enumerations", - "[request_handler][load_array_schema]") { + "[request_handler][load_array_schema][default]") { auto stype = GENERATE(SerializationType::JSON, SerializationType::CAPNP); create_array(); - REQUIRE(cfg_.set("rest.load_enumerations_on_array_open", "false").ok()); auto schema_response = call_handler(serialization::LoadArraySchemaRequest(cfg_), stype); auto schema = std::get<0>(schema_response); @@ -148,10 +147,11 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( HandleLoadArraySchemaRequestFx, "tiledb_handle_load_array_schema_request - load enumerations", - "[request_handler][load_array_schema][with-enumerations][default]") { + "[request_handler][load_array_schema][with-enumerations]") { auto stype = GENERATE(SerializationType::JSON, SerializationType::CAPNP); create_array(); + REQUIRE(cfg_.set("rest.load_enumerations_on_array_open", "true").ok()); auto schema_response = call_handler(serialization::LoadArraySchemaRequest(cfg_), stype); auto schema = std::get<0>(schema_response); @@ -173,6 +173,7 @@ TEST_CASE_METHOD( "tiledb_handle_load_array_schema_request - multiple schemas", "[request_handler][load_array_schema][schema-evolution]") { auto stype = GENERATE(SerializationType::JSON, SerializationType::CAPNP); + std::string load_enums = GENERATE("true", "false"); create_array(); @@ -184,15 +185,20 @@ TEST_CASE_METHOD( auto schema_response = call_handler(serialization::LoadArraySchemaRequest(cfg_), stype); auto schema = std::get<0>(schema_response); - REQUIRE(schema->has_enumeration("enmr")); - REQUIRE(schema->get_loaded_enumeration_names().size() == 1); - REQUIRE(schema->get_loaded_enumeration_names()[0] == "enmr"); - REQUIRE(schema->get_enumeration("enmr") != nullptr); + if (load_enums == "true") { + REQUIRE(schema->has_enumeration("enmr")); + REQUIRE(schema->get_loaded_enumeration_names().size() == 1); + REQUIRE(schema->get_loaded_enumeration_names()[0] == "enmr"); + REQUIRE(schema->get_enumeration("enmr") != nullptr); + } // The latest schema should be equal to the last applied evolution. tiledb::test::schema_equiv(*schema, *all_schemas.back()); - // Validate all array schemas returned from the request. - for (int i = 0; const auto& s : std::get<1>(schema_response)) { + // Validate schemas returned from the request in the order they were created. + auto r_all_schemas = std::get<1>(schema_response); + std::map> resp( + r_all_schemas.begin(), r_all_schemas.end()); + for (int i = 0; const auto& s : resp) { tiledb::test::schema_equiv(*s.second, *all_schemas[i++]); } } @@ -468,7 +474,8 @@ shared_ptr HandleLoadArraySchemaRequestFx::schema_add_attribute( tiledb::ArraySchemaEvolution ase(ctx); auto attr = tiledb::Attribute::create(ctx, attr_name); ase.add_attribute(attr); - auto evolved = ase.ptr()->array_schema_evolution_->evolve_schema(schema_); + // Evolve and update the original schema member variable. + schema_ = ase.ptr()->array_schema_evolution_->evolve_schema(schema_); // Apply the schema evolution. Array::evolve_array_schema( this->ctx_.resources(), @@ -476,10 +483,8 @@ shared_ptr HandleLoadArraySchemaRequestFx::schema_add_attribute( ase.ptr()->array_schema_evolution_, this->enc_key_); - // Update the original schema. - schema_ = evolved; - // Return the schema for validation. - return evolved; + // Return the new evolved schema for validation. + return schema_; } shared_ptr HandleLoadArraySchemaRequestFx::create_schema() { diff --git a/tiledb/api/c_api/config/config_api_external.h b/tiledb/api/c_api/config/config_api_external.h index be3d274b01e5..d04b453588f3 100644 --- a/tiledb/api/c_api/config/config_api_external.h +++ b/tiledb/api/c_api/config/config_api_external.h @@ -740,6 +740,10 @@ TILEDB_EXPORT void tiledb_config_free(tiledb_config_t** config) TILEDB_NOEXCEPT; * If true, array non empty domain will be loaded and sent to server together * with the open array
* **Default**: true + * - `rest.load_enumerations_on_array_open`
+ * If true, enumerations will be loaded and sent to server together with + * the open array. + * **Default**: false * - `rest.use_refactored_array_open`
* If true, the new, experimental REST routes and APIs for opening an array * will be used
diff --git a/tiledb/sm/array_schema/CMakeLists.txt b/tiledb/sm/array_schema/CMakeLists.txt index 25ba11fac8e5..1fb605bc9db1 100644 --- a/tiledb/sm/array_schema/CMakeLists.txt +++ b/tiledb/sm/array_schema/CMakeLists.txt @@ -97,7 +97,7 @@ conclude(object_library) # commence(object_library array_schema_operations) this_target_sources(array_schema_operations.cc) - this_target_object_libraries(array_schema generic_tile_io tiledb_crypto) + this_target_object_libraries(array array_schema generic_tile_io tiledb_crypto) conclude(object_library) add_test_subdirectory() diff --git a/tiledb/sm/config/config.cc b/tiledb/sm/config/config.cc index a22be700d268..680587b7ee0b 100644 --- a/tiledb/sm/config/config.cc +++ b/tiledb/sm/config/config.cc @@ -91,7 +91,7 @@ const std::string Config::REST_RETRY_DELAY_FACTOR = "1.25"; const std::string Config::REST_CURL_BUFFER_SIZE = "524288"; const std::string Config::REST_CAPNP_TRAVERSAL_LIMIT = "2147483648"; const std::string Config::REST_CURL_VERBOSE = "false"; -const std::string Config::REST_LOAD_ENUMERATIONS_ON_ARRAY_OPEN = "true"; +const std::string Config::REST_LOAD_ENUMERATIONS_ON_ARRAY_OPEN = "false"; const std::string Config::REST_LOAD_METADATA_ON_ARRAY_OPEN = "true"; const std::string Config::REST_LOAD_NON_EMPTY_DOMAIN_ON_ARRAY_OPEN = "true"; const std::string Config::REST_USE_REFACTORED_ARRAY_OPEN = "false"; diff --git a/tiledb/sm/cpp_api/config.h b/tiledb/sm/cpp_api/config.h index 9ffaabc4abef..f20935cee928 100644 --- a/tiledb/sm/cpp_api/config.h +++ b/tiledb/sm/cpp_api/config.h @@ -910,7 +910,7 @@ class Config { * - `rest.load_enumerations_on_array_open`
* If true, enumerations will be loaded and sent to server together with * the open array. - * **Default**: true + * **Default**: false * - `rest.load_metadata_on_array_open`
* If true, array metadata will be loaded and sent to server together with * the open array
diff --git a/tiledb/sm/serialization/array_schema.cc b/tiledb/sm/serialization/array_schema.cc index 64e9975082ec..cdf0eaae7f79 100644 --- a/tiledb/sm/serialization/array_schema.cc +++ b/tiledb/sm/serialization/array_schema.cc @@ -2154,7 +2154,7 @@ LoadArraySchemaRequest deserialize_load_array_schema_request( } void serialize_load_array_schema_response( - const ArraySchema&, SerializationType, Buffer&) { + const Array&, SerializationType, Buffer&) { throw ArraySchemaSerializationDisabledException(); }