MergeShards

Last Updated: Mar 31, 2017

Merges two adjacent shards in readwrite status. When a shard ID is specified in parameters, the server will automatically find the next adjacent shard.

Request syntax

  1. POST /logstores/<logstorename>/shards/<shardid>?action=merge HTTP/1.1
  2. Authorization: <AuthorizationString>
  3. Date: <GMT Date>
  4. Host: <Project Endpoint>
  5. x-log-apiversion: 0.6.0
  6. x-log-signaturemethod: hmac-sha1

Request parameters

Parameter Name Type Required or Not Description
logstoreName string Yes The logstore name
shardid int Yes shard ID

Request header

No special request header is available. For details about the public request header of the API, refer to Public Request Header.

Response header

Content-Type: application/json

No special response header is available. For details about the public response header of the API, refer to Public Response Header.

Response element

In an array consisting of 3 shards, the first shard is the result of merging, and the other two are not merged.

  1. [
  2. {
  3. 'shardID': 167,
  4. 'status': 'readwrite',
  5. 'inclusiveBeginKey': 'e0000000000000000000000000000000',
  6. 'createTime': 1453953105,
  7. 'exclusiveEndKey': 'ffffffffffffffffffffffffffffffff'
  8. },
  9. {
  10. 'shardID': 30,
  11. 'status': 'readonly',
  12. 'inclusiveBeginKey': 'e0000000000000000000000000000000',
  13. 'createTime': 0,
  14. 'exclusiveEndKey':
  15. 'e7000000000000000000000000000000'
  16. },
  17. {
  18. 'shardID': 166,
  19. 'status': 'readonly',
  20. 'inclusiveBeginKey': 'e7000000000000000000000000000000',
  21. 'createTime': 1453953073,
  22. 'exclusiveEndKey': 'ffffffffffffffffffffffffffffffff'
  23. }
  24. ]

Detailed description

N/A

Specific error codes

In addition to general error codes of the API, the following special error codes may be returned:

HTTP Status Code Error Code Error Message
404 LogStoreNotExist logstore {logstoreName} not exist
400 ParameterInvalid invalid shard id
400 ParameterInvalid can not merge the last shard
500 InternalServerError Specified Server Error Message
400 LogStoreWithoutShard logstore has no shard

The name variable in the above error messages will be replaced by the actual LogStore Name.

Example

Request example:
  1. POST /logstores/logstorename/shards/30?action=merge
  2. Header :
  3. {
  4. "Content-Length": 0,
  5. "x-log-signaturemethod": "hmac-sha1",
  6. "x-log-bodyrawsize": 0,
  7. "User-Agent": "log-python-sdk-v-0.6.0",
  8. "Host": "ali-test-project.cn-hangzhou.sls.aliyuncs.com",
  9. "Date": "Thu, 12 Nov 2015 03:40:31 GMT",
  10. "x-log-apiversion": "0.6.0",
  11. "Authorization": "LOG 94to3z418yupi6ikawqqd370:xEOsJ3xeidfdgRq0GbvACiO37jH0I="
  12. }
Response example:
  1. Header:
  2. {
  3. "content-length": "57",
  4. "server": "nginx/1.6.1",
  5. "connection": "close",
  6. "date": "Thu, 12 Nov 2015 03:40:31 GMT",
  7. "content-type": "application/json",
  8. "x-log-requestid": "56440A2F99248C050600C74C"
  9. }
  10. Body :
  11. [
  12. {
  13. 'shardID': 167,
  14. 'status': 'readwrite',
  15. 'inclusiveBeginKey': 'e0000000000000000000000000000000',
  16. 'createTime': 1453953105,
  17. 'exclusiveEndKey': 'ffffffffffffffffffffffffffffffff'
  18. },
  19. {
  20. 'shardID': 30,
  21. 'status': 'readonly',
  22. 'inclusiveBeginKey': 'e0000000000000000000000000000000',
  23. 'createTime': 0,
  24. 'exclusiveEndKey':
  25. 'e7000000000000000000000000000000'
  26. },
  27. {
  28. 'shardID': 166,
  29. 'status': 'readonly',
  30. 'inclusiveBeginKey': 'e7000000000000000000000000000000',
  31. 'createTime': 1453953073,
  32. 'exclusiveEndKey': 'ffffffffffffffffffffffffffffffff'
  33. }
  34. ]
Thank you! We've received your feedback.