Skip to content

Commit 9fdd24d

Browse files
authored
Merge pull request #72 from amazon-mq/docs/gh-71-review-all-docs
Review all documentation for technical correctness
2 parents 80ccf64 + af853f5 commit 9fdd24d

17 files changed

Lines changed: 139 additions & 118 deletions

AGENTS.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This plugin provides a production-ready solution for migrating mirrored classic
7777
### Prerequisites (BEFORE Migration)
7878

7979
1. **Cluster Health**: All cluster nodes must be running
80-
2. **Plugin Enabled**: `rabbitmq_queue_migration` and `rabbitmq_shovel` plugins loaded
80+
2. **Plugins Enabled**: `rabbitmq_queue_migration` and `rabbitmq_shovel` must be loaded; the `rabbitmq_queue_migration` plugin must additionally have completed its async initialization on every running node (validation chain step `plugin_ready_on_all_nodes`)
8181
3. **Queue Eligibility**: Only mirrored classic queues with HA policies
8282
4. **Khepri Disabled**: Classic Mnesia required (Khepri not compatible)
8383
5. **AWS Configuration**: For EBS snapshots, AWS credentials and region must be configured
@@ -233,10 +233,10 @@ GET /api/queue-migration/status/:id # Specific migration details
233233

234234
### Progress Tracking
235235

236-
- **Update Frequency**: Configurable via `progress_update_frequency` (default: 10)
237-
- **Calculation**: Messages processed ÷ 4 for progress count
238-
- **Real-time Updates**: Database updated during message migration
239-
- **Percentage Calculation**: `(completed / total) * 100`
236+
- **Update Frequency**: Configurable via `progress_update_frequency` (default: 10 messages between status writes)
237+
- **Verification on completion**: After the shovel reports completion, `rqm:verify_and_update_progress/5` reads the source and destination message counts and writes the actual delivered count via `rqm_db:update_queue_status_progress/3`
238+
- **Real-time Updates**: Database updated as queues complete each phase
239+
- **Percentage Calculation**: `rqm_mgmt:calculate_progress_percentage/2` computes `trunc((completed / total) * 100)`
240240

241241
**Note:** The setting `quorum_queue.property_equivalence.relaxed_checks_on_redeclaration = true` must be enabled **before** migration (validated during pre-migration checks). This allows applications to redeclare queues with classic arguments after migration without errors.
242242

@@ -288,11 +288,13 @@ GET /api/queue-migration/status/:id # Specific migration details
288288
**System Checks:**
289289
- `check_shovel_plugin/0` - Verify shovel plugin enabled
290290
- `check_khepri_disabled/0` - Verify Khepri not enabled
291+
- `check_relaxed_checks_setting/0` - Verify `quorum_queue.property_equivalence.relaxed_checks_on_redeclaration` is enabled
291292
- `check_leader_balance/1` - Verify queue leaders balanced
292-
- `check_disk_space/2` - Verify sufficient disk space
293+
- `check_disk_space/2` - Verify sufficient disk space (signature: `(VHost, UnsuitableQueues)`)
293294
- `check_active_alarms/0` - Check for memory/disk alarms
294295
- `check_memory_usage/0` - Verify memory usage acceptable
295296
- `check_snapshot_not_in_progress/0` - Verify no concurrent snapshots
297+
- `check_plugin_ready_on_all_nodes/0` - Verify the queue migration plugin reports `ready` on every running node
296298
- `check_cluster_partitions/0` - Verify no network partitions
297299

298300
**Queue Checks:**
@@ -317,6 +319,10 @@ GET /api/queue-migration/status/:id # Specific migration details
317319
**Key Functions:**
318320
- All configuration getters return values from application environment or defaults
319321
- See Configuration Parameters section for complete list
322+
323+
### `rqm_gatherer.erl` (Distributed Result Collection)
324+
325+
**Key Functions:**
320326
- `fork/1` - Declare intent to produce results (increment producer count)
321327
- `finish/1` - Signal completion of work (decrement producer count)
322328
- `in/2` - Add result to gatherer queue (async)
@@ -375,10 +381,11 @@ GET /api/queue-migration/status/:id # Specific migration details
375381
- `check_leader_balance/1` - Ensure balanced queue distribution
376382
- `check_queue_synchronization/1` - Verify all mirrors are synchronized
377383
- `check_queue_suitability/1` - Comprehensive queue eligibility
378-
- `check_disk_space/1` - Disk space estimation and validation based on worker pool concurrency
384+
- `check_disk_space/2` - Disk space estimation and validation (signature: `(VHost, UnsuitableQueues)`); required free = total queue data x peak multiplier + min disk space buffer
379385
- `check_active_alarms/0` - Check for active RabbitMQ alarms
380386
- `check_memory_usage/0` - Validate memory usage is within limits
381387
- `check_snapshot_not_in_progress/0` - Verify no concurrent EBS snapshots (delegates to `rqm_snapshot`)
388+
- `check_plugin_ready_on_all_nodes/0` - Verify the queue migration plugin is `ready` on every running cluster node
382389
- `check_cluster_partitions/0` - Verify no cluster partitions and all nodes up
383390
- `check_system_migration_readiness/1` - Overall system readiness
384391

@@ -393,9 +400,6 @@ GET /api/queue-migration/status/:id # Specific migration details
393400
- `format_migration_readiness_response/1` - Format readiness check response
394401
- `format_system_checks_for_ui/1` - Format system checks for web UI
395402
- `format_queue_checks_for_ui/1` - Format queue checks for web UI
396-
- `check_queue_suitability/1` - Comprehensive queue eligibility
397-
- `check_disk_space/1` - Disk space estimation and validation
398-
- `check_system_migration_readiness/1` - Overall system readiness
399403

400404
## Configuration Parameters
401405

@@ -674,7 +678,7 @@ Performance varies significantly based on:
674678
### AWS Configuration Requirements
675679
- **Credentials**: AWS credentials via environment variables, config files, or EC2 instance roles
676680
- **Region**: AWS region configuration (defaults to us-east-1, should match peer discovery)
677-
- **Permissions**: EC2 permissions for `CreateSnapshot`, `DescribeVolumes`, `DescribeSnapshots`, and `DescribeInstances`
681+
- **Permissions**: EC2 permissions for `ec2:DescribeVolumes`, `ec2:CreateSnapshot`, `ec2:DescribeSnapshots`, and `ec2:DeleteSnapshot`. The plugin does not call `ec2:CreateTags` or `ec2:DescribeInstances`.
678682
- **Volume Setup**: RabbitMQ data directory must be on EBS volume at configured device path
679683

680684
### Snapshot Timing
@@ -693,7 +697,7 @@ Performance varies significantly based on:
693697

694698
### Skip Unsuitable Queues Feature
695699
- **Skip Mode**: `skip_unsuitable_queues` parameter allows migration to proceed by skipping problematic queues
696-
- **Skip Reasons**: Tracks why queues were skipped (unsynchronized, too_many_queues, unsuitable_overflow, interrupted)
700+
- **Skip Reasons**: Tracks why queues were skipped. Validation produces five reasons via `#unsuitable_queue{reason = ...}` (`unsynchronized`, `too_many_queues`, `unsuitable_overflow`, `queue_expires`, `message_ttl`); a sixth `interrupted` status is recorded for queues from a previously interrupted migration
697701
- **Integration Tests**: SkipUnsuitableTest validates feature works correctly
698702

699703
### Batch Migration Feature

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Code of Conduct
1+
# Code of Conduct
22
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
33
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
44
opensource-codeofconduct@amazon.com with any additional questions or comments.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To build this plugin in your RabbitMQ development environment:
1717
git clone https://github.com/rabbitmq/rabbitmq-server.git
1818
cd rabbitmq-server
1919
git clone https://github.com/amazon-mq/rabbitmq-queue-migration.git deps/rabbitmq_queue_migration
20-
make -C deps/aws
20+
make -C deps/rabbitmq_queue_migration
2121
```
2222

2323
To run RabbitMQ with this plugin:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ A RabbitMQ plugin for migrating mirrored classic queues to quorum queues in Rabb
44

55
## Overview
66

7-
A RabbitMQ plugin for migrating mirrored classic queues to quorum queues in RabbitMQ 3.13.x clusters.
8-
97
- Two-phase migration algorithm with message-by-message transfer
108
- Automatic binding preservation and rollback support
119
- Selective migration by queue name or batch size
@@ -44,6 +42,7 @@ Restarting any broker node, performing a full cluster reboot, or applying a main
4442
- [Configuration Reference](docs/CONFIGURATION.md) - Configuration parameter reference
4543
- [EC2 Setup](docs/EC2_SETUP.md) - AWS EC2 and IAM configuration if EBS snapshots are used
4644
- [Performance Reference](docs/PERFORMANCE.md) - Real-world migration timing data
45+
- [Troubleshooting Guide](docs/TROUBLESHOOTING.md) - Error messages, diagnostics, and recovery
4746

4847
See [the `docs/` directory](https://github.com/amazon-mq/rabbitmq-queue-migration/tree/main/docs).
4948

RELEASE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ git push --tags
3131
* Ensure that Erlang/OTP 26.x and Elixir 1.16.x are in your `PATH`
3232

3333
```
34-
git clone --branch v4.2.x https://github.com/rabbitmq/rabbitmq-server.git rabbitmq-server_4.2.x
35-
cd rabbitmq-server_4.2.x
34+
git clone --branch v3.13.7 https://github.com/rabbitmq/rabbitmq-server.git rabbitmq-server_v3.13.7
35+
cd rabbitmq-server_v3.13.7
3636
git clone --branch "$VER" https://github.com/amazon-mq/rabbitmq-queue-migration.git deps/rabbitmq_queue_migration
3737
make
3838
make -C deps/rabbitmq_queue_migration

docs/API_EXAMPLES.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# API Examples - RabbitMQ Queue Migration Plugin
22

3-
**Last Updated:** January 21, 2026
4-
53
This document provides practical examples for all HTTP API endpoints with actual response structures verified against a running broker.
64

75
---
@@ -322,7 +320,7 @@ curl -u guest:guest \
322320
"total_queues": 50,
323321
"completed_queues": 45,
324322
"skipped_queues": 5,
325-
"progress_percentage": 100,
323+
"progress_percentage": 90,
326324
"skip_unsuitable_queues": true,
327325
"tolerance": 10.0,
328326
"error": null
@@ -383,7 +381,7 @@ curl -u guest:guest \
383381
"total_queues": 50,
384382
"completed_queues": 45,
385383
"skipped_queues": 5,
386-
"progress_percentage": 100,
384+
"progress_percentage": 90,
387385
"skip_unsuitable_queues": true,
388386
"error": null,
389387
"snapshots": [

docs/CONFIGURATION.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Configuration Reference
22

3-
**Last Updated:** January 21, 2026
4-
53
Complete reference for all configuration parameters in the RabbitMQ Queue Migration Plugin.
64

75
---
@@ -114,9 +112,14 @@ queue_migration.disk_usage_peak_multiplier = 3.0
114112

115113
**Calculation:**
116114
```
117-
Required space = (concurrent_workers × avg_queue_size × multiplier) + buffer
115+
Required space = (total_queue_data × multiplier) + min_disk_space_buffer
118116
```
119117

118+
Where:
119+
- `total_queue_data` = sum of disk usage across all migratable classic queues in the vhost (computed by `rqm_checks:estimate_migration_disk_usage/2`)
120+
- `multiplier` = the value of this setting
121+
- `min_disk_space_buffer` = the value of the [`min_disk_space_buffer`](#min_disk_space_buffer) setting (default 500 MB)
122+
120123
---
121124

122125
## Memory Configuration

docs/EC2_SETUP.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ The RabbitMQ queue migration plugin requires EC2 API access to:
1111
- Query attached EBS volumes (`ec2:DescribeVolumes`)
1212
- Create snapshots of those volumes (`ec2:CreateSnapshot`)
1313
- Check snapshot status (`ec2:DescribeSnapshots`)
14-
- Tag snapshots for identification (`ec2:CreateTags`)
1514
- Delete snapshots after successful migration (`ec2:DeleteSnapshot`)
1615

1716
When running on EC2 instances, the `rabbitmq_aws` SDK automatically retrieves temporary credentials (including session tokens) from the
@@ -77,7 +76,6 @@ aws iam put-role-policy \
7776
"ec2:DescribeVolumes",
7877
"ec2:CreateSnapshot",
7978
"ec2:DescribeSnapshots",
80-
"ec2:CreateTags",
8179
"ec2:DeleteSnapshot"
8280
],
8381
"Resource": "*"
@@ -97,7 +95,6 @@ restricting permissions to specific volumes or using condition keys to limit sco
9795
"ec2:DescribeVolumes",
9896
"ec2:CreateSnapshot",
9997
"ec2:DescribeSnapshots",
100-
"ec2:CreateTags",
10198
"ec2:DeleteSnapshot"
10299
],
103100
"Resource": "*",
@@ -232,8 +229,7 @@ VOLUME_ID=$(aws ec2 describe-volumes \
232229
aws ec2 create-snapshot \
233230
--region us-east-1 \
234231
--volume-id "$VOLUME_ID" \
235-
--description "Test snapshot for RabbitMQ queue migration" \
236-
--tag-specifications "ResourceType=snapshot,Tags=[{Key=Purpose,Value=Test}]"
232+
--description "Test snapshot for RabbitMQ queue migration"
237233
```
238234

239235
If successful, you'll receive a snapshot ID. Clean up the test snapshot:
@@ -307,9 +303,10 @@ The `rabbitmq_queue_migration` plugin performs the following operations during m
307303

308304
1. **Query Volumes**: Calls `ec2:DescribeVolumes` to find EBS volumes attached to the instance
309305
2. **Create Snapshots**: Calls `ec2:CreateSnapshot` to create crash-consistent snapshots before migration
310-
3. **Tag Snapshots**: Calls `ec2:CreateTags` to label snapshots with migration metadata
311-
4. **Monitor Progress**: Calls `ec2:DescribeSnapshots` to check snapshot completion status
312-
5. **Cleanup Snapshots**: Calls `ec2:DeleteSnapshot` to remove snapshots after successful migration (when `cleanup_snapshots_on_success` is enabled)
306+
3. **Monitor Progress**: Calls `ec2:DescribeSnapshots` to check snapshot completion status
307+
4. **Cleanup Snapshots**: Calls `ec2:DeleteSnapshot` to remove snapshots after successful migration (when `cleanup_snapshots_on_success` is enabled)
308+
309+
Snapshots are created with a `Description` of the form `RabbitMQ migration snapshot <timestamp> on <node>`, but the plugin does not attach EC2 tags to them (`ec2:CreateTags` is not required).
313310

314311
The plugin uses the AWS SDK's default credential provider chain, which automatically:
315312
- Queries the EC2 instance metadata service at `http://169.254.169.254/latest/meta-data/iam/security-credentials/`
@@ -340,8 +337,7 @@ EBS snapshots incur storage costs. Monitor snapshot usage:
340337
```bash
341338
aws ec2 describe-snapshots \
342339
--owner-ids self \
343-
--filters "Name=tag:Purpose,Values=RabbitMQ-Migration" \
344-
--query 'Snapshots[].[SnapshotId,VolumeSize,StartTime]' \
340+
--query 'Snapshots[?starts_with(Description, `RabbitMQ migration snapshot`)].[SnapshotId,VolumeSize,StartTime,Description]' \
345341
--output table
346342
```
347343

@@ -350,7 +346,7 @@ aws ec2 describe-snapshots \
350346
After completing these steps, your RabbitMQ EC2 instances will have the necessary IAM permissions to:
351347
- Query attached EBS volumes
352348
- Create snapshots during queue migration
353-
- Tag and monitor snapshot progress
349+
- Monitor snapshot status and delete snapshots after migration completes
354350

355351
The `rabbitmq_aws` library used by this plugin will automatically retrieve temporary credentials from the instance metadata
356352
service, including the required session token, without any explicit configuration.

docs/HTTP_API.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,17 @@ curl -u guest:guest http://localhost:15672/api/queue-migration/status
286286
- `completed_queues` - Queues completed so far
287287
- `skipped_queues` - Queues skipped
288288
- `progress_percentage` - Progress (0-100)
289-
- `status` - Migration status (see values below)
290-
- `skip_unsuitable_queues` - Whether skip mode was enabled
291-
- `tolerance` - Message count tolerance percentage (null if not set)
292-
- `error` - Error details (null if no error)
289+
- `status` - Migration status:
293290
- `pending` - Not started yet
294291
- `in_progress` - Currently migrating
295292
- `completed` - Successfully completed
296293
- `failed` - Migration failed
297294
- `interrupted` - Migration was interrupted
298295
- `rollback_pending` - Requires rollback
299296
- `rollback_completed` - Rollback completed
297+
- `skip_unsuitable_queues` - Whether skip mode was enabled
298+
- `tolerance` - Message count tolerance percentage (null if not set)
299+
- `error` - Error details (null if no error)
300300

301301
---
302302

@@ -685,10 +685,12 @@ curl -u guest:guest http://localhost:15672/api/queue-migration/rollback-pending
685685

686686
## Migration ID Format
687687

688-
Migration IDs are base64url-encoded Erlang terms containing:
689-
- Timestamp
690-
- Node name
691-
- Unique identifier
688+
Migration IDs are base64url-encoded Erlang terms. Each ID encodes a 2-tuple of:
689+
690+
- **Timestamp** - milliseconds since the epoch (`erlang:system_time(millisecond)`)
691+
- **Node name** - the Erlang node atom on which the migration was started (`node()`)
692+
693+
Source: `rqm_util:generate_migration_id/0` and `rqm_util:format_migration_id/1`.
692694

693695
**Example:**
694696
```

docs/INTEGRATION_TESTING.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,30 @@ This will:
3535
1. Build the plugin as an ez file
3636
2. Create custom Docker images with the plugin
3737
3. Start a 3-node RabbitMQ cluster
38-
4. Run end-to-end migration test (10 queues, 1000 messages)
39-
5. Validate migration success
38+
4. Run six end-to-end test scenarios against that cluster:
39+
- `end-to-end` - default migration (10 queues, 1000 messages)
40+
- `interrupt-test` - interrupting a migration mid-flight and resuming
41+
- `skip-unsuitable-test` - migration with `skip_unsuitable_queues=true`
42+
- `batch-test` - batch migration
43+
- `empty-queue-test` - migration of zero-message queues (fast path)
44+
- `already-quorum-test` - migration when destination type is already quorum
45+
5. Validate each scenario's success
4046
6. Stop the cluster
4147

42-
**Duration:** ~2-3 minutes
48+
**Duration:** ~10-15 minutes for the full six-scenario run; the
49+
`end-to-end` scenario alone is ~2-3 minutes.
4350

4451
## What Gets Tested
4552

46-
### Test Phases
53+
The `integration-test` target runs six scenarios against the same
54+
3-node Docker cluster: `end-to-end`, `interrupt-test`,
55+
`skip-unsuitable-test`, `batch-test`, `empty-queue-test`, and
56+
`already-quorum-test`. The phase breakdown below describes the
57+
`end-to-end` scenario, which is the most thorough; the other
58+
scenarios reuse most of the same setup and validation but with
59+
narrower payloads or specific options.
60+
61+
### Test Phases (`end-to-end`)
4762

4863
**Phase 0: Cleanup**
4964
- Removes previous test artifacts (queues, exchanges, policies)
@@ -89,7 +104,7 @@ Setup complete in 5165 ms
89104
Pre-migration: 10 classic queues, 1000 total messages
90105
91106
=== Phase 3: Triggering queue migration ===
92-
Migration started: g2gCbgYA8U2NKJsBdxhyYWJiaXQtMUBTRUEtM0xHNUhWSlVXSks
107+
Migration started: <base64-encoded-migration-id>
93108
94109
=== Phase 4: Monitoring migration progress ===
95110
[00:00:05] Migration in progress: 20% (2/10 queues)
@@ -185,7 +200,7 @@ The integration test supports various configurations. See [test/integration/READ
185200
### Hostname Resolution Fails
186201

187202
```
188-
ERROR: node0: Temporary failure in name resolution
203+
ERROR: rmq0: Temporary failure in name resolution
189204
```
190205

191206
**Solution:** Add `/etc/hosts` entries for rmq0, rmq1, rmq2

0 commit comments

Comments
 (0)