Consolidation and Vacuuming

Consolidation

Fragments

You can consolidate an array as follows. See Consolidation for how to fine-tune the consolidation algorithm with configuration parameters, and Configuration for more details on creating configuration objects.

// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// Consolidate, using ctx's configuration
tiledb_array_consolidate(ctx, array_name, NULL);

// Alteratively, you can create and pass a configuration object
tiledb_config_t* config;
tiledb_config_alloc(&config, NULL);
tiledb_config_set(config, "sm.consolidation.steps", "3", &error);
tiledb_config_set(config, "sm.consolidation.mode", "fragments", &error);
tiledb_array_consolidate(ctx, array_name, config);

// Clean-up
tiledb_ctx_free(&ctx);
tiledb_config_free(&config);

If you do not set a configuration object to the consolidation function, the consolidation algorithm will inherit the (default or set) configuration of the context. Otherwise, the set options in the passed configuration object will override those of the context's, but the rest of the options will still be inherited from the context's configuration.

Fragment Metadata

The same consolidation API is used for consolidating fragment metadata. The only change is configuration parameter "sm.consolidation.mode" which should now be set to "fragment_meta".

Array Metadata

The same consolidation API is used for consolidating array metadata. The only change is configuration parameter "sm.consolidation.mode" which should now be set to "array_meta".

Commits

The same consolidation API is used for consolidating commits. The only change is configuration parameter "sm.consolidation.mode" which should now be set to "commits".

Vacuuming

Fragments

After consolidation, you may optionally remove the consolidated fragments with the "vacuum" step. Note that vacuuming must not be run if you intend to use the time-traveling feature (opening array at a specific prior timestamp).

// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// Vacuum, using ctx's configuration
tiledb_array_vacuum(ctx, array_name, nullptr);

// Alteratively, you can create and pass a configuration object
tiledb_config_t* config;
tiledb_config_alloc(&config, NULL);
tiledb_config_set(config, "sm.vacuum.mode", "fragments", &error);
tiledb_array_vacuum(ctx, array_name, config);

// Clean-up
tiledb_ctx_free(&ctx);
tiledb_config_free(&config);

As with consolidation above, vacuuming inherits the context configuration if no configuration override is specified.

Fragment Metadata

The same vacuuming API is used for vacuuming fragment metadata. The only change is configuration parameter "sm.vacuum.mode" which should now be set to "fragment_meta".

Array Metadata

The same vacuuming API is used for vacuuming array metadata. The only change is configuration parameter "sm.vacuum.mode" which should now be set to "array_meta".

Commits

The same vacuuming API is used for vacumming commits. The only change is configuration parameter "sm.vacuum.mode" which should now be set to "commits".

Last updated