|
| 1 | +--- |
| 2 | +Title: Revamp database requests |
| 3 | +alwaysopen: false |
| 4 | +categories: |
| 5 | +- docs |
| 6 | +- operate |
| 7 | +- rs |
| 8 | +description: REST API requests to update database configuration and optimize shard placement |
| 9 | +headerRange: '[1-2]' |
| 10 | +linkTitle: revamp |
| 11 | +weight: $weight |
| 12 | +--- |
| 13 | + |
| 14 | +| Method | Path | Description | |
| 15 | +|--------|------|-------------| |
| 16 | +| [PUT](#put-bdbs-actions-revamp) | `/v1/bdbs/{uid}/actions/revamp` | Update database configuration and optimize shard placement | |
| 17 | + |
| 18 | +## Revamp database {#put-bdbs-actions-revamp} |
| 19 | + |
| 20 | +```sh |
| 21 | +PUT /v1/bdbs/{int: uid}/actions/revamp |
| 22 | +``` |
| 23 | + |
| 24 | +Updates the topology-related configurations of an active database and optimizes the shard placement for the new configuration. |
| 25 | + |
| 26 | +#### Required permissions |
| 27 | + |
| 28 | +| Permission name | Roles | |
| 29 | +|-----------------|-------| |
| 30 | +| [update_bdb_with_action]({{< relref "/operate/rs/references/rest-api/permissions#update_bdb_with_action" >}}) | admin<br />cluster_member<br />db_member | |
| 31 | + |
| 32 | +### Request {#put-request} |
| 33 | + |
| 34 | +You can include the following parameters in the request JSON body to update their values: |
| 35 | + |
| 36 | +| Field | Type/Value | Description | |
| 37 | +|-------|------------|-------------| |
| 38 | +| avoid_nodes | array of strings | Cluster node UIDs to avoid when placing the database's shards and binding its endpoints. | |
| 39 | +| bigstore_ram_size | integer | Memory size of bigstore RAM part. | |
| 40 | +| memory_size | integer (default: 0) | Database memory limit in bytes. 0 is unlimited. | |
| 41 | +| replication | boolean | If `true`, enable in-memory database replication mode. | |
| 42 | +| shards_count | integer, (range: 1-512) (default: 1) | Number of database server-side shards. | |
| 43 | +| shards_placement | "dense"<br />"sparse" | Control the density of shards. Values:<br />**dense**: Shards reside on as few nodes as possible.<br />**sparse**: Shards reside on as many nodes as possible. | |
| 44 | + |
| 45 | +#### Example HTTP request |
| 46 | + |
| 47 | +```sh |
| 48 | +PUT /v1/bdbs/1/actions/revamp |
| 49 | +{ |
| 50 | + "replication": true, |
| 51 | + "shards_count": 12 |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +Dry-run example: |
| 56 | + |
| 57 | +```sh |
| 58 | +PUT /v1/bdbs/1/actions/revamp?dry_run=true |
| 59 | +{ |
| 60 | + "replication": true, |
| 61 | + "shards_count": 12 |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +#### URL parameters |
| 66 | + |
| 67 | +| Field | Type | Description | |
| 68 | +|-------|------|-------------| |
| 69 | +| uid | integer | The unique ID of the database to update. | |
| 70 | + |
| 71 | +#### Query parameters |
| 72 | + |
| 73 | +| Field | Type | Description | |
| 74 | +|-------|------|-------------| |
| 75 | +| dry_run | boolean | If true, returns a blueprint of the database update without actually changing the database. Default is false. | |
| 76 | +| pause_persistence | boolean | If true, pause the persistence during the update. Default is false. | |
| 77 | + |
| 78 | +### Response {#put-response} |
| 79 | + |
| 80 | +- If `dry_run` is `false`, returns an `action_uid`. You can track the action's progress with a [`GET /v1/actions/<action_uid>`]({{<relref "/operate/rs/references/rest-api/requests/actions#get-action">}}) request. |
| 81 | + |
| 82 | +- If `dry_run` is `true`, returns a blueprint of the database update. |
| 83 | + |
| 84 | +#### Example response |
| 85 | + |
| 86 | +If `dry_run` is `false`: |
| 87 | + |
| 88 | +```sh |
| 89 | +{ |
| 90 | + "action_uid": "21ad01d5-55aa-4ec6-b5c0-44dc95176486" |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +If `dry_run` is `true`: |
| 95 | + |
| 96 | +```sh |
| 97 | +[ |
| 98 | + { |
| 99 | + "nodes": [ |
| 100 | + { |
| 101 | + "node_uid": "3", |
| 102 | + "role": "master" |
| 103 | + }, |
| 104 | + { |
| 105 | + "node_uid": "1", |
| 106 | + "role": "slave" |
| 107 | + } |
| 108 | + ], |
| 109 | + "slot_range": "5461-10922" |
| 110 | + }, |
| 111 | + { |
| 112 | + "nodes": [ |
| 113 | + { |
| 114 | + "node_uid": "3", |
| 115 | + "role": "master" |
| 116 | + }, |
| 117 | + { |
| 118 | + "node_uid": "1", |
| 119 | + "role": "slave" |
| 120 | + } |
| 121 | + ], |
| 122 | + "slot_range": "10923-16383" |
| 123 | + }, |
| 124 | + { |
| 125 | + "nodes": [ |
| 126 | + { |
| 127 | + "node_uid": "3", |
| 128 | + "role": "master" |
| 129 | + }, |
| 130 | + { |
| 131 | + "node_uid": "1", |
| 132 | + "role": "slave" |
| 133 | + } |
| 134 | + ], |
| 135 | + "slot_range": "0-5460" |
| 136 | + } |
| 137 | +] |
| 138 | +``` |
| 139 | + |
| 140 | +#### Status codes {#put-status-codes} |
| 141 | + |
| 142 | +| Code | Description | |
| 143 | +|------|-------------| |
| 144 | +| [200 OK](https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok) | When `dry_run` is false: The request is accepted and is being processed. The database state will be `active-change-pending` until the request has been fully processed. <br />When `dry_run` is true: No error. | |
| 145 | +| [404 Not Found](https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found) | Attempting to perform an action on a nonexistent database. | |
| 146 | +| [406 Not Acceptable](https://www.rfc-editor.org/rfc/rfc9110.html#name-406-not-acceptable) | The requested configuration is invalid. | |
| 147 | +| [409 Conflict](https://www.rfc-editor.org/rfc/rfc9110.html#name-409-conflict) | Attempting to change a database while it is busy with another configuration change. In this context, this is a temporary condition and the request should be re-attempted later. | |
0 commit comments