Skip to content

Instantly share code, notes, and snippets.

@arriqaaq
Created February 13, 2023 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriqaaq/e14b4fbf9dda247520b64d3916db47c8 to your computer and use it in GitHub Desktop.
Save arriqaaq/e14b4fbf9dda247520b64d3916db47c8 to your computer and use it in GitHub Desktop.
Truncation Test Scenarios

Data Retention/Truncation Command Line Interface (CLI) Documentation

Introduction: The truncation command is an extention to the immuadmin CLI to perform data retention operations on a database. It supports parameters to specify the retention period and truncation frequency.

Usage: The CLI is invoked from the command line with the following syntax:

./immuadmin database create db [OPTIONS]

Options: The following options are available for use with the CLI:

--retention-period duration                    duration of time to retain data in storage (in multiple of days)
--truncation-frequency duration                set the truncation frequency for the database (default 24h0m0s)

--truncation-frequency: Specifies the frequency at which the background goroutine runs periodically --retention-period: Specifies the retention period of the database in days. This parameter determines how far back in time the data retention process should go.

Examples:

The following examples demonstrate how to use the CLI when creating a database:

# Retain all data types for the past 1 day
./immuadmin database create db  --sync-frequency 5ms --retention-period=24h 

# Retain for the past 2 days
./immuadmin database create db  --sync-frequency 5ms --retention-period=48h 

# Increase the truncation frequency (should not be required by normal users)
./immuadmin database create db  --sync-frequency 5ms --retention-period=48h --truncation-frequency=24h

The following examples demonstrate how to use the CLI when truncating a database:

 ./immuadmin database truncate --yes-i-know-what-i-am-doing=true [database_name]  --retention-period=24h

Scenarios to test:

  • Writes to database works post truncation
  • SQL writes work on a table post truncation. This requires creating a table initially and then inserting data into it. Post truncation, the insertion into this table should still work.
  • Replication works as expected. Master should be loaded with data, and then truncated up to a certain point. Post truncation, a new replica must be setup and replication should work fine as expected. (Note: Values won't be copied, but transaction headers/proofs will be copied for truncated data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment