@@ -146,21 +146,21 @@ void Consolidator::array_consolidate(
146146 throw ConsolidatorException (" Cannot consolidate array; Invalid URI" );
147147 }
148148
149- // Check if array exists
150- ObjectType obj_type;
151- throw_if_not_ok (
152- object_type (storage_manager->resources (), array_uri, &obj_type));
153-
154- if (obj_type != ObjectType::ARRAY) {
155- throw ConsolidatorException (
156- " Cannot consolidate array; Array does not exist" );
157- }
158-
159149 if (array_uri.is_tiledb ()) {
160150 throw_if_not_ok (
161151 storage_manager->resources ().rest_client ()->post_consolidation_to_rest (
162152 array_uri, config));
163153 } else {
154+ // Check if array exists
155+ ObjectType obj_type;
156+ throw_if_not_ok (
157+ object_type (storage_manager->resources (), array_uri, &obj_type));
158+
159+ if (obj_type != ObjectType::ARRAY) {
160+ throw ConsolidatorException (
161+ " Cannot consolidate array; Array does not exist" );
162+ }
163+
164164 // Get encryption key from config
165165 std::string encryption_key_from_cfg;
166166 if (!encryption_key) {
@@ -210,50 +210,58 @@ void Consolidator::fragments_consolidate(
210210 throw ConsolidatorException (" Cannot consolidate array; Invalid URI" );
211211 }
212212
213- // Check if array exists
214- ObjectType obj_type;
215- throw_if_not_ok (
216- object_type (storage_manager->resources (), array_uri, &obj_type));
213+ if (array_uri.is_tiledb ()) {
214+ throw_if_not_ok (
215+ storage_manager->resources ().rest_client ()->post_consolidation_to_rest (
216+ array_uri, config, &fragment_uris));
217+ } else {
218+ // Check if array exists
219+ ObjectType obj_type;
220+ throw_if_not_ok (
221+ object_type (storage_manager->resources (), array_uri, &obj_type));
217222
218- if (obj_type != ObjectType::ARRAY) {
219- throw ConsolidatorException (
220- " Cannot consolidate array; Array does not exist" );
221- }
223+ if (obj_type != ObjectType::ARRAY) {
224+ throw ConsolidatorException (
225+ " Cannot consolidate array; Array does not exist" );
226+ }
222227
223- // Get encryption key from config
224- std::string encryption_key_from_cfg;
225- if (!encryption_key) {
226- bool found = false ;
227- encryption_key_from_cfg = config.get (" sm.encryption_key" , &found);
228- assert (found);
229- }
228+ // Get encryption key from config
229+ std::string encryption_key_from_cfg;
230+ if (!encryption_key) {
231+ bool found = false ;
232+ encryption_key_from_cfg = config.get (" sm.encryption_key" , &found);
233+ assert (found);
234+ }
235+
236+ if (!encryption_key_from_cfg.empty ()) {
237+ encryption_key = encryption_key_from_cfg.c_str ();
238+ key_length = static_cast <uint32_t >(encryption_key_from_cfg.size ());
239+ std::string encryption_type_from_cfg;
240+ bool found = false ;
241+ encryption_type_from_cfg = config.get (" sm.encryption_type" , &found);
242+ assert (found);
243+ auto [st, et] = encryption_type_enum (encryption_type_from_cfg);
244+ throw_if_not_ok (st);
245+ encryption_type = et.value ();
230246
231- if (!encryption_key_from_cfg.empty ()) {
232- encryption_key = encryption_key_from_cfg.c_str ();
233- key_length = static_cast <uint32_t >(encryption_key_from_cfg.size ());
234- std::string encryption_type_from_cfg;
235- bool found = false ;
236- encryption_type_from_cfg = config.get (" sm.encryption_type" , &found);
237- assert (found);
238- auto [st, et] = encryption_type_enum (encryption_type_from_cfg);
239- throw_if_not_ok (st);
240- encryption_type = et.value ();
241-
242- if (!EncryptionKey::is_valid_key_length (
243- encryption_type,
244- static_cast <uint32_t >(encryption_key_from_cfg.size ()))) {
245- encryption_key = nullptr ;
246- key_length = 0 ;
247+ if (!EncryptionKey::is_valid_key_length (
248+ encryption_type,
249+ static_cast <uint32_t >(encryption_key_from_cfg.size ()))) {
250+ encryption_key = nullptr ;
251+ key_length = 0 ;
252+ }
247253 }
248- }
249254
250- // Consolidate
251- auto consolidator = Consolidator::create (
252- ConsolidationMode::FRAGMENT, config, storage_manager);
253- auto fragment_consolidator =
254- dynamic_cast <FragmentConsolidator*>(consolidator.get ());
255- throw_if_not_ok (fragment_consolidator->consolidate_fragments (
256- array_name, encryption_type, encryption_key, key_length, fragment_uris));
255+ // Consolidate
256+ auto fragment_consolidator =
257+ make_shared<FragmentConsolidator>(HERE (), config, storage_manager);
258+ throw_if_not_ok (fragment_consolidator->consolidate_fragments (
259+ array_name,
260+ encryption_type,
261+ encryption_key,
262+ key_length,
263+ fragment_uris));
264+ }
257265}
258266
259267void Consolidator::write_consolidated_commits_file (
0 commit comments