Skip to content

Fix primary key index definition error in update operation #203

@Voloodya

Description

@Voloodya

The problem defining the index of a field with a primary key in function findSuitableIndex()
The problem is that fieldIndex = -1 in indexParts

`private static TarantoolIndexMetadata findSuitableIndex(TarantoolMetadataOperations operations,
                                                            TarantoolSpaceMetadata spaceMetadata,
                                                            Collection<TarantoolFieldMetadata> selectedFields) {
        Map<String, TarantoolIndexMetadata> allIndexes = operations.getSpaceIndexes(spaceMetadata.getSpaceName())
                .orElseThrow(() -> new TarantoolClientException(
                        "Metadata for space %s not found", spaceMetadata.getSpaceName()));

        TarantoolIndexMetadata suitableIndex = allIndexes.values().stream()
                .filter(metadata -> isSuitableIndex(metadata, selectedFields))
                .min(Comparator.comparingInt(m -> m.getIndexParts().size())) // Here
                .orElseThrow(() -> new TarantoolClientException("No indexes that fit the passed fields are found"));

        return suitableIndex;
    }`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions