diff --git a/api.go b/api.go index f462830ff..28860e894 100644 --- a/api.go +++ b/api.go @@ -1767,9 +1767,11 @@ func (api *API) TranslateIndexIDs(ctx context.Context, indexName string, ids []u } // TranslateKeys handles a TranslateKeyRequest. -func (api *API) TranslateKeys(ctx context.Context, r io.Reader, writable bool) (_ []byte, err error) { +// ErrTranslatingKeyNotFound error will be swallowed here, so the empty response will be returned. +func (api *API) TranslateKeys(ctx context.Context, r io.Reader) (_ []byte, err error) { var req TranslateKeysRequest - if buf, err := ioutil.ReadAll(r); err != nil { + buf, err := ioutil.ReadAll(r) + if err != nil { return nil, NewBadRequestError(errors.Wrap(err, "read translate keys request error")) } else if err := api.Serializer.Unmarshal(buf, &req); err != nil { return nil, NewBadRequestError(errors.Wrap(err, "unmarshal translate keys request error")) @@ -1778,25 +1780,25 @@ func (api *API) TranslateKeys(ctx context.Context, r io.Reader, writable bool) ( // Lookup store for either index or field and translate keys. var ids []uint64 if req.Field == "" { - if ids, err = api.cluster.translateIndexKeys(ctx, req.Index, req.Keys, writable); err != nil { - return nil, err - } + ids, err = api.cluster.translateIndexKeys(ctx, req.Index, req.Keys, !req.NotWritable) } else { - if field := api.holder.Field(req.Index, req.Field); field == nil { + field := api.holder.Field(req.Index, req.Field) + if field == nil { return nil, newNotFoundError(ErrFieldNotFound, req.Field) - } else if fi := field.ForeignIndex(); fi != "" { - ids, err = api.cluster.translateIndexKeys(ctx, fi, req.Keys, writable) - if err != nil { - return nil, err - } - } else if ids, err = api.cluster.translateFieldKeys(ctx, field, req.Keys, writable); err != nil { - return nil, errors.Wrapf(err, "translating field keys") } + + if fi := field.ForeignIndex(); fi != "" { + ids, err = api.cluster.translateIndexKeys(ctx, fi, req.Keys, !req.NotWritable) + } else { + ids, err = api.cluster.translateFieldKeys(ctx, field, req.Keys, !req.NotWritable) + } + } + if err != nil && errors.Cause(err) != ErrTranslatingKeyNotFound { + return nil, errors.WithMessage(err, "translating keys") } // Encode response. - buf, err := api.Serializer.Marshal(&TranslateKeysResponse{IDs: ids}) - if err != nil { + if buf, err = api.Serializer.Marshal(&TranslateKeysResponse{IDs: ids}); err != nil { return nil, errors.Wrap(err, "translate keys response encoding error") } return buf, nil diff --git a/boltdb/translate.go b/boltdb/translate.go index 55c837eac..1e593a245 100644 --- a/boltdb/translate.go +++ b/boltdb/translate.go @@ -171,21 +171,22 @@ func (s *TranslateStore) Size() int64 { } // TranslateKey converts a string key to an integer ID. -// If key does not have an associated id then one is created. +// If key does not have an associated id then one is created, unless writable is false, +// then the function will return the error pilosa.ErrTranslatingKeyNotFound. func (s *TranslateStore) TranslateKey(key string, writable bool) (uint64, error) { ids, err := s.translateKeys([]string{key}, writable) if err != nil { return 0, err } if len(ids) == 0 { - // this should not happen return 0, ErrTranslateKeyNotFound } return ids[0], nil } // TranslateKeys converts a slice of string keys to a slice of integer IDs. -// If a key does not have an associated id then one is created. +// If a key does not have an associated id then one is created, unless writable is false, +// then the function will return the error pilosa.ErrTranslatingKeyNotFound. func (s *TranslateStore) TranslateKeys(keys []string, writable bool) ([]uint64, error) { return s.translateKeys(keys, writable) } diff --git a/client.go b/client.go index a07167b67..42ec51ba0 100644 --- a/client.go +++ b/client.go @@ -88,7 +88,9 @@ type InternalClient interface { // InternalQueryClient is the internal interface for querying a node. type InternalQueryClient interface { QueryNode(ctx context.Context, uri *URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) - TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string) ([]uint64, error) + + // Trasnlate keys on the particular node. The parameter writable informs TranslateStore if we can generate a new ID if any of keys does not exist. + TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string, writable bool) ([]uint64, error) TranslateIDsNode(ctx context.Context, uri *URI, index, field string, id []uint64) ([]string, error) } @@ -98,7 +100,7 @@ func (n *nopInternalQueryClient) QueryNode(ctx context.Context, uri *URI, index return nil, nil } -func (n nopInternalQueryClient) TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string) ([]uint64, error) { +func (n nopInternalQueryClient) TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string, writable bool) ([]uint64, error) { return nil, nil } @@ -145,7 +147,7 @@ func (n nopInternalClient) Query(ctx context.Context, index string, queryRequest func (n nopInternalClient) QueryNode(ctx context.Context, uri *URI, index string, queryRequest *QueryRequest) (*QueryResponse, error) { return nil, nil } -func (n nopInternalClient) TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string) ([]uint64, error) { +func (n nopInternalClient) TranslateKeysNode(ctx context.Context, uri *URI, index, field string, keys []string, writable bool) ([]uint64, error) { return nil, nil } func (n nopInternalClient) TranslateIDsNode(ctx context.Context, uri *URI, index, field string, ids []uint64) ([]string, error) { diff --git a/cluster.go b/cluster.go index 61a2babc7..9e2f504e2 100644 --- a/cluster.go +++ b/cluster.go @@ -2346,7 +2346,7 @@ func (c *cluster) translateFieldKey(ctx context.Context, field *Field, key strin if err != nil { return 0, err } else if len(ids) == 0 { - return 0, errors.New("translating key on coordinator returned empty set") + return 0, nil } return ids[0], nil } @@ -2363,11 +2363,12 @@ func (c *cluster) translateFieldKeys(ctx context.Context, field *Field, keys []s // to the coordinator. if errors.Cause(err) == ErrTranslateStoreReadOnly { coordinatorNode := c.coordinatorNode() - if ids, err := c.InternalClient.TranslateKeysNode(ctx, &coordinatorNode.URI, field.Index(), field.Name(), keys); err != nil { - return ids, errors.Wrap(err, "translating keys on coordinator") - } else { + + ids, err := c.InternalClient.TranslateKeysNode(ctx, &coordinatorNode.URI, field.Index(), field.Name(), keys, writable) + if err == nil { return ids, nil } + return ids, errors.Wrap(err, "translating keys on coordinator") } return ids, err } @@ -2428,7 +2429,7 @@ func (c *cluster) translateIndexKeySet(ctx context.Context, indexName string, ke } } else { nodes := c.partitionNodes(partitionID) - if ids, err = c.InternalClient.TranslateKeysNode(ctx, &nodes[0].URI, indexName, "", keys); err != nil { + if ids, err = c.InternalClient.TranslateKeysNode(ctx, &nodes[0].URI, indexName, "", keys, writable); err != nil { return err } } diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index ac4b56e07..309bb136f 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -853,9 +853,10 @@ func (s Serializer) encodeRecalculateCaches(*pilosa.RecalculateCaches) *internal func (s Serializer) encodeTranslateKeysRequest(request *pilosa.TranslateKeysRequest) *internal.TranslateKeysRequest { return &internal.TranslateKeysRequest{ - Index: request.Index, - Field: request.Field, - Keys: request.Keys, + Index: request.Index, + Field: request.Field, + Keys: request.Keys, + NotWritable: request.NotWritable, } } @@ -1298,6 +1299,7 @@ func (s Serializer) decodeTranslateKeysRequest(pb *internal.TranslateKeysRequest m.Index = pb.Index m.Field = pb.Field m.Keys = pb.Keys + m.NotWritable = pb.NotWritable } func (s Serializer) decodeTranslateKeysResponse(pb *internal.TranslateKeysResponse, m *pilosa.TranslateKeysResponse) { diff --git a/handler.go b/handler.go index 495641255..7b49e8500 100644 --- a/handler.go +++ b/handler.go @@ -283,6 +283,9 @@ type TranslateKeysRequest struct { Index string Field string Keys []string + + // it's a awkward name, just to keep backward compatibility with go-pilosa and idk. + NotWritable bool } // TranslateKeysResponse is the structured response of a key diff --git a/http/client.go b/http/client.go index c99d8cdb0..5f4e25b8a 100644 --- a/http/client.go +++ b/http/client.go @@ -1140,8 +1140,9 @@ func (c *InternalClient) SendMessage(ctx context.Context, uri *pilosa.URI, msg [ return errors.Wrap(err, "draining SendMessage response body") } -// TranslateKeysNode sends a key translation request to a specific node. -func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, index, field string, keys []string) ([]uint64, error) { +// TranslateKeysNode function is mainly called to translate keys from coordinator node. +// If coordinator node returns 404 error the function wraps it with pilosa.ErrTranslatingKeyNotFound. +func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, index, field string, keys []string, writable bool) ([]uint64, error) { span, ctx := tracing.StartSpanFromContext(ctx, "TranslateKeysNode") defer span.Finish() @@ -1150,9 +1151,10 @@ func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, } buf, err := c.serializer.Marshal(&pilosa.TranslateKeysRequest{ - Index: index, - Field: field, - Keys: keys, + Index: index, + Field: field, + Keys: keys, + NotWritable: !writable, }) if err != nil { return nil, errors.Wrap(err, "marshaling TranslateKeysRequest") @@ -1174,6 +1176,9 @@ func (c *InternalClient) TranslateKeysNode(ctx context.Context, uri *pilosa.URI, // Execute request against the host. resp, err := c.executeRequest(req.WithContext(ctx)) if err != nil { + if resp != nil && resp.StatusCode == http.StatusNotFound { + return nil, errors.Wrap(pilosa.ErrTranslatingKeyNotFound, err.Error()) + } return nil, err } defer resp.Body.Close() diff --git a/http/handler.go b/http/handler.go index a0470139d..c1020c941 100644 --- a/http/handler.go +++ b/http/handler.go @@ -2432,17 +2432,22 @@ func (h *Handler) handlePostTranslateKeys(w http.ResponseWriter, r *http.Request return } - buf, err := h.api.TranslateKeys(r.Context(), r.Body, true) - if err != nil { - http.Error(w, fmt.Sprintf("translate keys: %v", err), http.StatusInternalServerError) - return - } + buf, err := h.api.TranslateKeys(r.Context(), r.Body) + switch errors.Cause(err) { + case nil: + // Write response. + if _, err = w.Write(buf); err != nil { + h.logger.Printf("writing translate keys response: %v", err) + } - // Write response. - _, err = w.Write(buf) - if err != nil { - h.logger.Printf("writing translate keys response: %v", err) - return + case pilosa.ErrTranslatingKeyNotFound: + http.Error(w, fmt.Sprintf("translate keys: %v", err), http.StatusNotFound) + + case pilosa.ErrTranslateStoreReadOnly: + http.Error(w, fmt.Sprintf("translate keys: %v", err), http.StatusPreconditionFailed) + + default: + http.Error(w, fmt.Sprintf("translate keys: %v", err), http.StatusInternalServerError) } } diff --git a/internal/public.pb.go b/internal/public.pb.go index 219625518..36ede10fa 100644 --- a/internal/public.pb.go +++ b/internal/public.pb.go @@ -2116,6 +2116,7 @@ type TranslateKeysRequest struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Field string `protobuf:"bytes,2,opt,name=Field,proto3" json:"Field,omitempty"` Keys []string `protobuf:"bytes,3,rep,name=Keys,proto3" json:"Keys,omitempty"` + NotWritable bool `protobuf:"varint,4,opt,name=NotWritable,proto3" json:"NotWritable,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2175,6 +2176,13 @@ func (m *TranslateKeysRequest) GetKeys() []string { return nil } +func (m *TranslateKeysRequest) GetNotWritable() bool { + if m != nil { + return m.NotWritable + } + return false +} + type TranslateKeysResponse struct { IDs []uint64 `protobuf:"varint,3,rep,packed,name=IDs,proto3" json:"IDs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -2611,110 +2619,111 @@ func init() { func init() { proto.RegisterFile("public.proto", fileDescriptor_413a91106d7bcce8) } var fileDescriptor_413a91106d7bcce8 = []byte{ - // 1648 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6e, 0xdb, 0xc6, - 0x13, 0x37, 0x45, 0xea, 0x6b, 0x24, 0x3b, 0xce, 0x46, 0xc9, 0x9f, 0xc8, 0xdf, 0x71, 0x04, 0xc2, - 0x6d, 0xd4, 0xa2, 0x70, 0xe0, 0x34, 0x09, 0x72, 0x69, 0x1b, 0x3b, 0x72, 0x6a, 0x22, 0xb5, 0x9b, - 0xae, 0x0c, 0xf7, 0x56, 0x80, 0x96, 0xb6, 0x0e, 0x51, 0x4a, 0x54, 0x29, 0x2a, 0xb2, 0x2f, 0x05, - 0xfa, 0x0c, 0xb9, 0xf4, 0x11, 0xfa, 0x1c, 0xbd, 0xb4, 0xc7, 0x1e, 0x0b, 0xf4, 0x52, 0xa4, 0x8f, - 0x91, 0x1e, 0x8a, 0x99, 0xe5, 0x6a, 0x49, 0x8a, 0x76, 0x8c, 0xa0, 0xb7, 0x9d, 0x8f, 0x9d, 0x9d, - 0xf9, 0xcd, 0xec, 0xec, 0x90, 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, - 0x35, 0xae, 0x19, 0x6c, 0x1d, 0x40, 0x21, 0x3b, 0x15, 0xd4, 0xcd, 0x0c, 0x9e, 0xe2, 0x38, 0x77, - 0xa1, 0x8a, 0x9e, 0xee, 0x7b, 0x63, 0x1d, 0x9b, 0x71, 0x51, 0x6c, 0x6f, 0x0c, 0x68, 0x7e, 0x35, - 0x15, 0xd1, 0x19, 0x17, 0xdf, 0x4f, 0xc5, 0x24, 0x46, 0x6c, 0x89, 0x56, 0xb5, 0x4c, 0x04, 0x56, - 0x6d, 0xef, 0x85, 0x17, 0x0d, 0x24, 0x52, 0x16, 0x4f, 0x28, 0x8c, 0x55, 0x63, 0x3e, 0xa1, 0x58, - 0x6b, 0x3c, 0xcd, 0xa2, 0x7a, 0x17, 0xc3, 0x30, 0x56, 0xc1, 0x24, 0x14, 0xeb, 0xc0, 0x95, 0xdd, - 0xd3, 0x7e, 0x30, 0x1d, 0x08, 0x1e, 0xce, 0xe4, 0x6e, 0x6a, 0xce, 0x3c, 0xcf, 0x66, 0xef, 0x63, - 0x73, 0x23, 0x96, 0x6a, 0x4d, 0x55, 0x52, 0xcc, 0x71, 0xd9, 0x16, 0x34, 0x77, 0x87, 0xc7, 0x62, - 0x30, 0x10, 0x83, 0xae, 0x17, 0x7b, 0x76, 0x8d, 0xe2, 0xce, 0x3d, 0xf8, 0x19, 0x15, 0xe7, 0x95, - 0x01, 0xcb, 0x49, 0xf4, 0x93, 0x71, 0x38, 0x9a, 0x08, 0x4c, 0xf1, 0x6e, 0x14, 0xa9, 0x14, 0xef, - 0x46, 0x11, 0xbb, 0x0b, 0x55, 0x2e, 0x26, 0xd3, 0x20, 0x56, 0x55, 0x72, 0x5d, 0x5b, 0x54, 0x7b, - 0xa7, 0x41, 0xcc, 0x95, 0x16, 0xfb, 0x0c, 0x56, 0x32, 0x75, 0xa8, 0x9e, 0x85, 0xff, 0xe9, 0x7d, - 0x19, 0x39, 0xcf, 0xa9, 0x3b, 0x6f, 0x2c, 0x68, 0x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 0xc7, 0xc9, 0xf8, 0x93, 0x50, - 0xce, 0x2f, 0x86, 0xc2, 0x30, 0x35, 0x76, 0xbd, 0x35, 0x93, 0xfa, 0x5a, 0x98, 0xea, 0x5a, 0xd8, - 0x72, 0x76, 0xd4, 0x23, 0xb2, 0x22, 0x71, 0x5e, 0xc5, 0x25, 0xfd, 0xa9, 0xb0, 0x28, 0x7b, 0x73, - 0xfa, 0x2d, 0xbd, 0x68, 0x11, 0x84, 0x4a, 0x11, 0x08, 0x3b, 0xab, 0xbf, 0xbd, 0x5e, 0x37, 0x7e, - 0x7f, 0xbd, 0x6e, 0xfc, 0xf5, 0x7a, 0xdd, 0xf8, 0xe9, 0xef, 0xf5, 0xa5, 0xe3, 0x0a, 0xfd, 0x69, - 0xfa, 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0xaa, 0x41, 0xe0, 0x79, 0x12, 0x00, 0x00, + // 1663 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6e, 0xdb, 0xce, + 0x11, 0x37, 0x45, 0xea, 0x6b, 0x24, 0xfb, 0xef, 0x6c, 0x94, 0x94, 0x48, 0x1d, 0x47, 0x20, 0xdc, + 0x46, 0x2d, 0x0a, 0x07, 0x4e, 0x93, 0x20, 0x97, 0xb6, 0xb1, 0x23, 0xa7, 0x26, 0x52, 0xbb, 0xe9, + 0xca, 0x70, 0x6e, 0x05, 0x68, 0x69, 0xeb, 0x10, 0xa5, 0x44, 0x95, 0xa2, 0x22, 0xfb, 0x52, 0xa0, + 0xcf, 0x90, 0x4b, 0x1f, 0xa1, 0xcf, 0xd1, 0x4b, 0x7b, 0xec, 0xb1, 0x40, 0x2f, 0x45, 0xfa, 0x18, + 0xe9, 0xa1, 0x98, 0x59, 0xae, 0x76, 0x49, 0xd1, 0x8e, 0x11, 0xf4, 0xb6, 0xf3, 0xb1, 0xb3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, 0xde, + 0x97, 0x93, 0xf3, 0x82, 0xba, 0xf7, 0xc5, 0x81, 0x96, 0x61, 0x79, 0x59, 0x64, 0x88, 0xcf, 0x7a, + 0x56, 0x64, 0x8f, 0x68, 0xee, 0xba, 0x66, 0xea, 0xc1, 0x9e, 0xd4, 0x06, 0xeb, 0x24, 0x2b, 0x4b, + 0xeb, 0x44, 0x37, 0x42, 0xfb, 0xa6, 0x46, 0x88, 0x53, 0xdc, 0x87, 0x60, 0x72, 0x21, 0x46, 0x54, + 0x96, 0x0d, 0xae, 0x48, 0xb6, 0xab, 0xbb, 0x02, 0xe5, 0x31, 0xd7, 0x6b, 0x94, 0x84, 0xeb, 0xce, + 0x21, 0xbb, 0x1c, 0x4e, 0x06, 0x75, 0x59, 0x2f, 0x92, 0x62, 0x2f, 0xa0, 0xa5, 0xdb, 0xd7, 0x2c, + 0x4b, 0x51, 0x47, 0x9b, 0xd2, 0x42, 0x6e, 0x2a, 0xb2, 0x57, 0xc5, 0x11, 0xcd, 0x6d, 0x92, 0x17, + 0x6e, 0x2e, 0x72, 0x43, 0xce, 0x8b, 0x23, 0xdd, 0x9e, 0x31, 0x33, 0xba, 0x40, 0x9b, 0xef, 0xea, + 0xcd, 0x4b, 0x11, 0x37, 0x26, 0xcb, 0x67, 0xe6, 0x5b, 0xe2, 0xb6, 0x68, 0x4f, 0x27, 0x8f, 0x9c, + 0x94, 0x71, 0xf3, 0xcd, 0xd9, 0x33, 0x1e, 0x32, 0xb7, 0x5d, 0x3c, 0x68, 0x29, 0xe2, 0xc6, 0x73, + 0xe7, 0x97, 0xcc, 0x77, 0xee, 0x3a, 0x6d, 0x2d, 0x1f, 0xde, 0xa4, 0x0a, 0x2f, 0x99, 0x0a, 0x5f, + 0x15, 0x27, 0x01, 0x77, 0xa3, 0x08, 0x54, 0x5e, 0xce, 0x0b, 0xfa, 0xde, 0xdf, 0x2a, 0xb0, 0xee, + 0x8f, 0xa7, 0x71, 0x92, 0x1a, 0x2d, 0xc1, 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cb, 0xcf, 0x56, 0x2e, 0x89, 0x92, 0xab, 0x52, 0xbd, 0xe5, 0x55, 0xa9, + 0x95, 0x5e, 0x95, 0xfb, 0x50, 0xeb, 0x87, 0x89, 0x18, 0xa6, 0xd9, 0x80, 0x94, 0x51, 0xde, 0x5f, + 0x2d, 0x85, 0xa1, 0x31, 0x98, 0x7d, 0x35, 0x93, 0xfa, 0xe2, 0xd8, 0xea, 0xe2, 0xb8, 0x72, 0xba, + 0xd4, 0x43, 0xb4, 0x22, 0x71, 0xa2, 0xc5, 0x25, 0xfd, 0xcb, 0x70, 0x28, 0x7b, 0x4b, 0xfa, 0x2b, + 0xdd, 0x6a, 0x15, 0x84, 0x5a, 0x19, 0x08, 0x07, 0x9b, 0x7f, 0xff, 0xbc, 0x6d, 0xfd, 0xe3, 0xf3, + 0xb6, 0xf5, 0xef, 0xcf, 0xdb, 0xd6, 0x9f, 0xff, 0xb3, 0xbd, 0x76, 0x5e, 0xa3, 0x7f, 0x51, 0x3f, + 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x65, 0xe6, 0x0c, 0x9b, 0x12, 0x00, 0x00, } func (m *Row) Marshal() (dAtA []byte, err error) { @@ -4663,6 +4672,16 @@ func (m *TranslateKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.NotWritable { + i-- + if m.NotWritable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(m.Keys) > 0 { for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Keys[iNdEx]) @@ -5946,6 +5965,9 @@ func (m *TranslateKeysRequest) Size() (n int) { n += 1 + l + sovPublic(uint64(l)) } } + if m.NotWritable { + n += 2 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -11369,6 +11391,26 @@ func (m *TranslateKeysRequest) Unmarshal(dAtA []byte) error { } m.Keys = append(m.Keys, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NotWritable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NotWritable = bool(v != 0) default: iNdEx = preIndex skippy, err := skipPublic(dAtA[iNdEx:]) diff --git a/internal/public.proto b/internal/public.proto index 4a4bf71c5..c7080a8da 100644 --- a/internal/public.proto +++ b/internal/public.proto @@ -175,7 +175,7 @@ message ImportRequest { repeated int64 Timestamps = 6; int64 IndexCreatedAt = 9; int64 FieldCreatedAt = 10; - bool Clear = 11; + bool Clear = 11; } message ImportValueRequest { @@ -207,6 +207,7 @@ message TranslateKeysRequest { string Index = 1; string Field = 2; repeated string Keys = 3; + bool NotWritable = 4; } message TranslateKeysResponse { diff --git a/server/config_test.go b/server/config_test.go index 593551463..c8ef422a4 100644 --- a/server/config_test.go +++ b/server/config_test.go @@ -48,12 +48,7 @@ func TestDuration(t *testing.T) { t.Fatalf("Unexpected marshalled value %v", v) } - err := d.UnmarshalText([]byte("5")) - if err.Error() != "time: missing unit in duration 5" { - t.Fatalf("expected time: missing unit in duration: %s", err) - } - - err = d.UnmarshalText([]byte("3m2s")) + err := d.UnmarshalText([]byte("3m2s")) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/translator_test.go b/translator_test.go index be90f9ba9..f38ea5706 100644 --- a/translator_test.go +++ b/translator_test.go @@ -290,12 +290,138 @@ func TestTranslation_Reset(t *testing.T) { if err != nil { t.Fatal(err) } - if _, err := node0.API.TranslateKeys(ctx, bytes.NewReader(reqBody), true); err != nil { + if _, err := node0.API.TranslateKeys(ctx, bytes.NewReader(reqBody)); err != nil { t.Fatal(err) } }) } +func TestTranslation_KeyNotFound(t *testing.T) { + c := test.MustRunCluster(t, 4, + []server.CommandOption{ + server.OptCommandServerOptions( + pilosa.OptServerIsCoordinator(true), + pilosa.OptServerNodeID("node0"), + pilosa.OptServerOpenTranslateStore(boltdb.OpenTranslateStore), + pilosa.OptServerOpenTranslateReader(http.GetOpenTranslateReaderFunc(nil)), + )}, + []server.CommandOption{ + server.OptCommandServerOptions( + pilosa.OptServerIsCoordinator(false), + pilosa.OptServerNodeID("node1"), + pilosa.OptServerOpenTranslateStore(boltdb.OpenTranslateStore), + pilosa.OptServerOpenTranslateReader(http.GetOpenTranslateReaderFunc(nil)), + )}, + []server.CommandOption{ + server.OptCommandServerOptions( + pilosa.OptServerIsCoordinator(false), + pilosa.OptServerNodeID("node2"), + pilosa.OptServerOpenTranslateStore(boltdb.OpenTranslateStore), + pilosa.OptServerOpenTranslateReader(http.GetOpenTranslateReaderFunc(nil)), + )}, + []server.CommandOption{ + server.OptCommandServerOptions( + pilosa.OptServerIsCoordinator(false), + pilosa.OptServerNodeID("node3"), + pilosa.OptServerOpenTranslateStore(boltdb.OpenTranslateStore), + pilosa.OptServerOpenTranslateReader(http.GetOpenTranslateReaderFunc(nil)), + )}, + ) + defer c.Close() + + node0 := c.GetNode(0) + node1 := c.GetNode(1) + node2 := c.GetNode(2) + node3 := c.GetNode(3) + + ctx := context.Background() + idx, fld := "i", "f" + // Create an index with keys. + if _, err := node0.API.CreateIndex(ctx, idx, pilosa.IndexOptions{Keys: true}); err != nil { + t.Fatal(err) + } + // Create an index with keys. + if _, err := node0.API.CreateField(ctx, idx, fld, pilosa.OptFieldKeys()); err != nil { + t.Fatal(err) + } + + // write a new key and get id + req, err := node0.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{ + Index: idx, + Field: fld, + Keys: []string{"k1"}, + NotWritable: false, + }) + if err != nil { + t.Fatal(err) + } + + if buf, err := node0.API.TranslateKeys(ctx, bytes.NewReader(req)); err != nil { + t.Fatal(err) + } else { + var resp pilosa.TranslateKeysResponse + if err = node0.API.Serializer.Unmarshal(buf, &resp); err != nil { + t.Fatal(err) + } + id0 := resp.IDs[0] + + // read non-existing key + req, err = node3.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{ + Index: idx, + Field: fld, + Keys: []string{"k2"}, + NotWritable: true, + }) + if err != nil { + t.Fatal(err) + } + if buf, err = node3.API.TranslateKeys(ctx, bytes.NewReader(req)); err != nil { + t.Fatal(err) + } + if err = node3.API.Serializer.Unmarshal(buf, &resp); err != nil { + t.Fatal(err) + } else if resp.IDs != nil { + t.Fatalf("TranslateKeys(%+v): expected: nil, got: %d", req, resp) + } + + req, err = node2.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{ + Index: idx, + Keys: []string{"k2"}, + NotWritable: true, + }) + if err != nil { + t.Fatal(err) + } + if buf, err = node2.API.TranslateKeys(ctx, bytes.NewReader(req)); err != nil { + t.Fatal(err) + } + if err = node2.API.Serializer.Unmarshal(buf, &resp); err != nil { + t.Fatal(err) + } else if resp.IDs != nil { + t.Fatalf("TranslateKeys(%+v): expected: nil, got: %d", req, resp) + } + + req, err = node1.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{ + Index: idx, + Field: fld, + Keys: []string{"k2"}, + NotWritable: false, + }) + if err != nil { + t.Fatal(err) + } + if buf, err = node0.API.TranslateKeys(ctx, bytes.NewReader(req)); err != nil { + t.Fatal(err) + } + if err = node0.API.Serializer.Unmarshal(buf, &resp); err != nil { + t.Fatal(err) + } + if resp.IDs[0] != id0+1 { + t.Fatalf("TranslateKeys(%+v): expected: %d, got: %d", req, id0+1, resp.IDs[0]) + } + } +} + func TestInMemTranslateStore_ReadKey(t *testing.T) { s := pilosa.NewInMemTranslateStore("IDX", "FLD", 0, pilosa.DefaultPartitionN)