Skip to content

Commit

Permalink
vault: added optional config to enable/disable DataNodeSizeWorker thread
Browse files Browse the repository at this point in the history
  • Loading branch information
pdowler committed Apr 24, 2024
1 parent 1baad59 commit c149158
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions vault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ org.opencadc.vault.consistency.preventNotFound=true|false
# (optional) identify which container nodes are allocations
org.opencadc.vault.allocationParent = {top level node}
# (optional) enable or disable internal DataNode size sync from inventory (default: true)
org.opencadc.vault.enableDataNodeSizeWorker = true|false
# vault database settings
org.opencadc.vault.inventory.schema = {inventory schema name}
org.opencadc.vault.vospace.schema = {vospace schema name}
Expand Down Expand Up @@ -121,6 +124,13 @@ be configured to organise the top level of the content (e.g. /home and /projects
_allocationParent_(s) will be automatically created (if necessary), owned by the _rootOwner_, and will be
anonymously readable (public). Limitation: only a single level of top-level _allocationParent_(s) are supported.

The _enableDataNodeSizeWorker_ key can be used to disable the background thread that syncs inventory
Artifact metadata (currently just contentLength) into vospace DataNode instances. This is currently
done to support correct DataNode size output when listing a ContainerNode. Instances of `vault` cooperate
to pick a _leader_ to perform the sync (others are idle and occassionally check if they need to take over
the role of _leader_) so disabling this feature is only needed if deploying a special instance that shares
the vospace database but should never do this background work (e.g. testing a new image before release).

The _inventory.schema_ name is the name of the database schema used for all inventory database objects. This
currently must be "inventory" due to configuration limitations in <a href="../luskan">luskan</a>.

Expand Down
11 changes: 10 additions & 1 deletion vault/src/main/java/org/opencadc/vault/VaultInitAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class VaultInitAction extends InitAction {
static final String ALLOCATION_PARENT = VAULT_KEY + ".allocationParent";
static final String ROOT_OWNER = VAULT_KEY + ".root.owner";
static final String STORAGE_NAMESPACE_KEY = VAULT_KEY + ".storage.namespace";
static final String ENABLE_DATANODE_SIZE_WORKER_KEY = VAULT_KEY + ".enableDataNodeSizeWorker";

MultiValuedProperties props;
private URI resourceID;
Expand Down Expand Up @@ -471,13 +472,21 @@ private void terminateAvailabilityCheck() {
}

private void initBackgroundWorkers() {
String str = props.getFirstPropertyValue(ENABLE_DATANODE_SIZE_WORKER_KEY);
if (str != null) {
boolean enableDataNodeSizeWorker = Boolean.valueOf(str);
if (!enableDataNodeSizeWorker) {
log.info("initBackgroundWorkers: DataNodeSizeWorker disabled");
return;
}
}
try {
HarvestStateDAO hsDAO = new HarvestStateDAO();
hsDAO.setConfig(vosDaoConfig);

ArtifactDAO artifactDAO = new ArtifactDAO();
Map<String,Object> iterprops = getIteratorConfig(props);
log.warn("iterator pool: " + iterprops.get("jndiDataSourceName"));
log.debug("iterator pool: " + iterprops.get("jndiDataSourceName"));
artifactDAO.setConfig(iterprops);

// determine startup mode
Expand Down

0 comments on commit c149158

Please sign in to comment.