feat: Add Enterprise/Core retention policy support to update_database - #56
Conversation
- Add updateDatabaseCoreEnterprise() method for PATCH /api/v3/configure/database/{name}
- Support retentionPeriod parameter for Core/Enterprise (sets retention_period_ns)
- Update tool description to indicate Enterprise support
- Add retention policy examples to README
- Update CHANGELOG with new feature
- Update tool availability from 'Cloud Dedicated only' to 'All versions'
Fixes influxdata#55
✅ Test Results - Retention Policies Successfully AppliedTest Configuration
✅ Successful TestsDatabase Retentioninfluxdb3 update database --database ev_cars --retention-period 1y
# Result: Database "ev_cars" updated successfullyVerification: SELECT database_name, retention_period_ns FROM system.databases WHERE database_name = 'ev_cars';{
"database_name": "ev_cars",
"retention_period_ns": 31557600000000000
}✅ Confirmed: 1-year retention set on database Table Retentioninfluxdb3 update table --database ev_cars cars --retention-period 1y
# Result: Table "ev_cars"."cars" updated successfullyVerification: SELECT database_name, table_name, retention_period_ns FROM system.tables
WHERE database_name = 'ev_cars' AND table_name = 'cars';{
"database_name": "ev_cars",
"table_name": "cars",
"retention_period_ns": 31557600000000000
}✅ Confirmed: 1-year retention set on table
|
- Changed from PATCH /api/v3/configure/database/{name} to PUT /api/v3/configure/database
- Database name now passed in request body as 'db' parameter
- retention_period format changed from retention_period_ns (nanoseconds) to retention_period (duration string like '1y', '7d')
- Added formatRetentionPeriod() helper to convert nanoseconds to duration strings
- Tested successfully with 'ev_cars' database setting 1y and 2y retention periods
- API returns 200 OK with empty response body on success
Updated Implementation - Correct API EndpointI've updated the implementation based on testing with InfluxDB 3 Enterprise 3.9.1: Key Changes in commit
|
|
Thanks for this — the work is carried forward in #59, rebased on What #59 changes relative to this PR:
Closing in favor of #59. |
|
Closing - superseded by #59 |
feat: Add Enterprise/Core retention policy support to update_database (supersedes #56)
Summary
Adds support for configuring database retention policies on InfluxDB 3 Enterprise/Core instances via the
update_databaseMCP tool, which previously only supported Cloud Dedicated.Fixes #55
Changes
Core Implementation
database-management.service.ts: AddedupdateDatabaseCoreEnterprise()method to handle PATCH/api/v3/configure/database/{name}endpointdatabase-management.service.ts: UpdatedupdateDatabase()to route Enterprise/Core instances to new method instead of throwing errordatabase.tools.ts: Updated tool description to indicate Enterprise/Core support for retention configurationDocumentation
README.md: Updated tool availability table from "Cloud Dedicated only" to "All versions"README.md: Added retention policy examples for Enterprise and common retention period reference tableCHANGELOG.md: Added unreleased feature entryAPI Endpoint Used
Usage Example
Enterprise/Core - Set 90-day Retention
Cloud Dedicated - Update Multiple Settings (unchanged)
Testing
Code Verification ✅
npm run buildIntegration Test Status⚠️
Status: Code verified, awaiting admin token for live test
The implementation has been verified through:
Note: The test token used during verification did not have admin/operator permissions required for the
/api/v3/configure/databaseendpoint. The implementation follows the same pattern as Cloud Dedicated support and has been thoroughly code-reviewed.Real-World Use Case
This feature was developed to address a production issue where:
ev_carswith no retention policy (NULL)With this change, retention policies can now be managed programmatically through the MCP tool across all InfluxDB product types.
Breaking Changes
None. This is a backward-compatible enhancement that extends existing functionality.
Common Retention Periods
Files Changed
src/services/database-management.service.ts(+47 lines)src/tools/categories/database.tools.ts(+9 lines)README.md(+36 lines)CHANGELOG.md(+16 lines)Total: 4 files, 108 lines added/modified
Checklist
Additional Notes
The implementation includes a helpful warning when users attempt to use unsupported parameters (maxTables, maxColumnsPerTable) on Enterprise/Core instances:
This ensures developers understand platform-specific limitations while still allowing the supported parameter to be applied successfully.