Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions migration-context/link-placeholders/database-link-placeholders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Link Placeholders for Database Section

## reference_versioned_docs/version-v4/database/overview.md

- Line ~37: `[Resource API](TODO:reference_versioned_docs/version-v4/resources/resource-api.md)`
- Context: Mentioning custom resources as extension of the database system
- Target should be: Resource API reference page

- Line ~55: `[REST](TODO:reference_versioned_docs/version-v4/rest/overview.md)`
- Context: Related documentation footer
- Target should be: REST overview

- Line ~56: `[Resources](TODO:reference_versioned_docs/version-v4/resources/overview.md)`
- Context: Related documentation footer
- Target should be: Resources overview

- Line ~57: `[Operations API](TODO:reference_versioned_docs/version-v4/operations-api/overview.md)`
- Context: Related documentation footer
- Target should be: Operations API overview

- Line ~58: `[Configuration](TODO:reference_versioned_docs/version-v4/configuration/overview.md)`
- Context: Related documentation footer
- Target should be: Configuration overview

## reference_versioned_docs/version-v4/database/schema.md

- Line ~164: `[REST Querying](TODO:reference_versioned_docs/version-v4/rest/querying.md)`
- Context: How to query tables via HTTP using schema-defined relationships
- Target should be: REST querying reference

- Line ~165: `[Resources](TODO:reference_versioned_docs/version-v4/resources/resource-api.md)`
- Context: Extending table behavior with custom resource logic
- Target should be: Resource API reference

- Line ~167: `[Configuration](TODO:reference_versioned_docs/version-v4/configuration/options.md)`
- Context: graphqlSchema component and storage configuration
- Target should be: Configuration options page

- Line ~141 (Dynamic Schema section): `[Operations API](TODO:reference_versioned_docs/version-v4/operations-api/operations.md)`
- Context: NoSQL create_attribute/drop_attribute operations
- Target should be: Operations list page

## reference_versioned_docs/version-v4/database/data-loader.md

- Line ~13: `[Extension](TODO:reference_versioned_docs/version-v4/components/extension-api.md)`
- Context: dataLoader is an Extension component
- Target should be: Extension API reference

- Line ~73: `[Components](TODO:reference_versioned_docs/version-v4/components/overview.md)`
- Context: Related documentation footer
- Target should be: Components overview

## reference_versioned_docs/version-v4/database/storage-algorithm.md

- Line ~45: `[Configuration](TODO:reference_versioned_docs/version-v4/configuration/options.md)`
- Context: Storage configuration options (compression settings)
- Target should be: Configuration options page (storage section)

## reference_versioned_docs/version-v4/database/jobs.md

- Line ~128: `[Operations API](TODO:reference_versioned_docs/version-v4/operations-api/overview.md)`
- Context: Related documentation footer
- Target should be: Operations API overview

## reference_versioned_docs/version-v4/database/system-tables.md

- Line ~82: `[Analytics](TODO:reference_versioned_docs/version-v4/analytics/overview.md)`
- Context: Full analytics metrics reference in related docs footer
- Target should be: Analytics overview

- Line ~95: `[Replication](TODO:reference_versioned_docs/version-v4/replication/clustering.md)`
- Context: hdb_nodes used by clustering operations
- Target should be: Clustering reference

- Line ~104: `[Analytics](TODO:reference_versioned_docs/version-v4/analytics/overview.md)` (second reference)
- Context: Related documentation footer
- Target should be: Analytics overview

- Line ~105: `[Replication](TODO:reference_versioned_docs/version-v4/replication/overview.md)`
- Context: Related documentation footer
- Target should be: Replication overview

- Line ~106: `[Operations API](TODO:reference_versioned_docs/version-v4/operations-api/overview.md)`
- Context: Querying system tables
- Target should be: Operations API overview

## reference_versioned_docs/version-v4/database/compaction.md

- Line ~38: `[CLI Commands](TODO:reference_versioned_docs/version-v4/cli/commands.md)`
- Context: copy-db CLI command
- Target should be: CLI commands reference

- Line ~56: `[Configuration](TODO:reference_versioned_docs/version-v4/configuration/options.md)`
- Context: Storage configuration options
- Target should be: Configuration options page (storage section)

## reference_versioned_docs/version-v4/database/transaction.md

- Line ~73: `[Replication](TODO:reference_versioned_docs/version-v4/replication/overview.md)`
- Context: Clustering must be set up for transaction logs
- Target should be: Replication overview

- Line ~148: `[Logging](TODO:reference_versioned_docs/version-v4/logging/overview.md)`
- Context: Distinction between app logging and transaction/audit logging
- Target should be: Logging overview

- Line ~149: `[Replication](TODO:reference_versioned_docs/version-v4/replication/overview.md)` (second reference)
- Context: Related documentation footer
- Target should be: Replication overview

- Line ~150: `[Configuration](TODO:reference_versioned_docs/version-v4/configuration/options.md)`
- Context: logging.auditLog global configuration
- Target should be: Configuration options page

- Line ~151: `[Operations API](TODO:reference_versioned_docs/version-v4/operations-api/overview.md)`
- Context: Related documentation footer
- Target should be: Operations API overview
4 changes: 2 additions & 2 deletions reference_versioned_docs/version-v4/cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ This copies the default `data` database to a new location with compaction applie
- Creating compacted backups
- Reclaiming free space

See also: [Database Compaction](TODO:reference_versioned_docs/version-v4/database/compaction.md 'Database compaction reference') for more information.
See also: [Database Compaction](../database/compaction.md) for more information.

#### How Backups Work

Expand Down Expand Up @@ -266,4 +266,4 @@ The CLI supports executing commands on remote Harper instances. For details, see
- [Operations API Commands](./operations-api-commands.md) - Operations available through CLI
- [CLI Authentication](./authentication.md) - Authentication mechanisms
- [Configuration](TODO:reference_versioned_docs/version-v4/configuration/overview.md 'Configuration') - Configuration parameters for installation
- [Database Compaction](TODO:reference_versioned_docs/version-v4/database/compaction.md 'Compaction') - More on database compaction
- [Database Compaction](../database/compaction.md) - More on database compaction
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ last_updated_record: 1724483231970.9949
```

:::tip
For detailed information on database and table structures, see the [Database Reference](TODO:reference_versioned_docs/version-v4/database/overview.md 'Database reference documentation').
For detailed information on database and table structures, see the [Database Reference](../database/overview.md).
:::

### Data Operations
Expand Down
71 changes: 71 additions & 0 deletions reference_versioned_docs/version-v4/database/compaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Compaction
---

<!-- Source: versioned_docs/version-4.7/administration/compact.md (primary) -->
<!-- Source: release-notes/v4-tucker/4.3.0.md (compact database functionality added) -->

# Compaction

Added in: v4.3.0

Database files grow over time as records are inserted, updated, and deleted. Deleted records and updated values leave behind free space (fragmentation) in the database file, which can increase file size and potentially affect performance. Compaction eliminates this free space, creating a smaller, contiguous database file.

> **Note:** Compaction does not compress your data. It removes internal fragmentation to make the file smaller. To enable compression on a database, use compaction to copy the database with updated storage configuration applied.

Compaction is also the mechanism to apply storage configuration changes (such as enabling compression) to existing databases, since some storage settings cannot be changed in-place.

## Copy Compaction

Creates a compacted copy of a database file. The original database is left unchanged.

> **Recommendation:** Stop Harper before performing copy compaction to prevent any record loss during the copy operation.

Run using the [CLI](../cli/commands.md):

```bash
harperdb copy-db <source-database> <target-database-path>
```

The `source-database` is the database name (not a file path). The target is the full file path where the compacted copy will be written.

To replace the original database with the compacted copy, move or rename the output file to the original database path after Harper is stopped.

**Example — compact the default `data` database:**

```bash
harperdb copy-db data /home/user/hdb/database/copy.mdb
```

## Compact on Start

Automatically compacts all non-system databases when Harper starts. Harper will not start until compaction is complete. Under the hood, it loops through all user databases, creates a backup of each, compacts it, replaces the original with the compacted copy, and removes the backup.

Configure in `harperdb-config.yaml`:

```yaml
storage:
compactOnStart: true
compactOnStartKeepBackup: false
```

Using CLI environment variables:

```bash
STORAGE_COMPACTONSTART=true STORAGE_COMPACTONSTARTKEEPBACKUP=true harperdb
```

### Options

| Option | Type | Default | Description |
| -------------------------- | ------- | ------- | ------------------------------------------------------------------------------- |
| `compactOnStart` | Boolean | `false` | Compact all databases at startup. Automatically reset to `false` after running. |
| `compactOnStartKeepBackup` | Boolean | `false` | Retain the backup copy created during compact on start |

> **Note:** `compactOnStart` is automatically set back to `false` after it runs, so compaction only happens on the next start if you explicitly re-enable it.

## Related Documentation

- [Storage Algorithm](./storage-algorithm.md) — How Harper stores data using LMDB
- [CLI Commands](../cli/commands.md) — `copy-db` CLI command reference
- [Configuration](TODO:reference_versioned_docs/version-v4/configuration/options.md 'storage section') — Full storage configuration options including compression settings
Loading