diff --git a/Documentation/api.md b/Documentation/api.md index 088c84148..af252198f 100644 --- a/Documentation/api.md +++ b/Documentation/api.md @@ -380,7 +380,7 @@ curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job1 "action": "create", "node": { "createdIndex": 6, - "key": "/queue/6", + "key": "/queue/00000000000000000006", "modifiedIndex": 6, "value": "Job1" } @@ -399,7 +399,7 @@ curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job2 "action": "create", "node": { "createdIndex": 29, - "key": "/queue/29", + "key": "/queue/00000000000000000029", "modifiedIndex": 29, "value": "Job2" } @@ -423,13 +423,13 @@ curl -s 'http://127.0.0.1:2379/v2/keys/queue?recursive=true&sorted=true' "nodes": [ { "createdIndex": 2, - "key": "/queue/2", + "key": "/queue/00000000000000000002", "modifiedIndex": 2, "value": "Job1" }, { "createdIndex": 3, - "key": "/queue/3", + "key": "/queue/00000000000000000003", "modifiedIndex": 3, "value": "Job2" } diff --git a/integration/v2_http_kv_test.go b/integration/v2_http_kv_test.go index 0c10fd5ca..f96c118fe 100644 --- a/integration/v2_http_kv_test.go +++ b/integration/v2_http_kv_test.go @@ -541,7 +541,7 @@ func TestV2Unique(t *testing.T) { http.StatusCreated, map[string]interface{}{ "node": map[string]interface{}{ - "key": "/foo/4", + "key": "/foo/00000000000000000004", "value": "XXX", }, "action": "create", @@ -553,7 +553,7 @@ func TestV2Unique(t *testing.T) { http.StatusCreated, map[string]interface{}{ "node": map[string]interface{}{ - "key": "/foo/5", + "key": "/foo/00000000000000000005", "value": "XXX", }, "action": "create", @@ -565,7 +565,7 @@ func TestV2Unique(t *testing.T) { http.StatusCreated, map[string]interface{}{ "node": map[string]interface{}{ - "key": "/bar/6", + "key": "/bar/00000000000000000006", "value": "XXX", }, "action": "create", diff --git a/store/store.go b/store/store.go index 4e74e24f1..c925c62b3 100644 --- a/store/store.go +++ b/store/store.go @@ -495,7 +495,7 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique, currIndex, nextIndex := s.CurrentIndex, s.CurrentIndex+1 if unique { // append unique item under the node path - nodePath += "/" + strconv.FormatUint(nextIndex, 10) + nodePath += "/" + fmt.Sprintf("%020s", strconv.FormatUint(nextIndex, 10)) } nodePath = path.Clean(path.Join("/", nodePath))