Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary select in update operation #129

Open
ArtDu opened this issue Jul 28, 2023 · 1 comment
Open

Remove unnecessary select in update operation #129

ArtDu opened this issue Jul 28, 2023 · 1 comment

Comments

@ArtDu
Copy link
Contributor

ArtDu commented Jul 28, 2023

protected <T> List<T> update(Conditions query, TupleOperations updateOperations, Class<T> entityClass) {
Assert.notNull(query, "Conditions must not be null!");
Assert.notNull(updateOperations, "Update operations must not be null!");
Assert.notNull(entityClass, "Entity class must not be null!");
TarantoolPersistentEntity<?> entityMetadata = mappingContext.getRequiredPersistentEntity(entityClass);
TarantoolResult<TarantoolTuple> tuplesForUpdate = executeSync(() ->
tarantoolClient.space(entityMetadata.getSpaceName()).select(query)
);
List<CompletableFuture<TarantoolResult<TarantoolTuple>>> futures = tuplesForUpdate.stream()
.map(tuple -> tarantoolClient.space(entityMetadata.getSpaceName())
.update(idQueryFromTuple(tuple, entityMetadata), updateOperations))
.collect(Collectors.toList());
return getFutureValue(queryExecutors.submit(
() -> futures.stream().parallel()
.map(this::getFutureValue)
.map(tuples -> mapFirstToEntity(tuples, entityClass))
.collect(Collectors.toList())
));
}

Git blame points at you @akudiyar. May you remember why it's done this way?

@akudiyar
Copy link
Collaborator

akudiyar commented Jul 30, 2023

This update implementation was really non-optimal and I did a quick solution for fulfilling the client's requirements at that time. Maybe some comments on this are in the git history. The biggest problem was that tarantool/crud did not support update operation.

@dkasimovskiy dkasimovskiy changed the title Remove non necessary select in update operation Remove unnecessary select in update operation Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants