Skip to content

CrudRepository.deleteAll not working #512

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

Closed
ggreen opened this issue Jun 2, 2021 · 3 comments
Closed

CrudRepository.deleteAll not working #512

ggreen opened this issue Jun 2, 2021 · 3 comments
Assignees
Labels
bug in-progress Work is in-progress.

Comments

@ggreen
Copy link

ggreen commented Jun 2, 2021

The CrudRepository.deleteAll() method is not removing all records.

Sample

    @Repository
    public interface AccountGeodeRepository extends CrudRepository<Account,String>  {

        Iterable<Account> findByName(String name);

        Iterable<Account> findByNameLike(String name);

    }
@ClientCacheApplication
@EnableEntityDefinedRegions
@EnableSecurity
public class GeodeConfig {
}

Controller

@AllArgsConstructor
@RestController
@RequestMapping("geode/accounts")
public class AccountGeodeController {

    private final AccountGeodeRepository repository;

    @DeleteMapping("deleteAll")
    public void deleteAll() {
        repository.deleteAll();
    }
}
....
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 2, 2021
@jxblum jxblum self-assigned this Jun 2, 2021
@jxblum
Copy link
Contributor

jxblum commented Jun 2, 2021

FYI, when filing SDG issues, please follow the required Issue ticket anatomy.

@jxblum
Copy link
Contributor

jxblum commented Jun 2, 2021

It appears your Spring application is a ClientCache application given the declaration of the @ClientCacheApplication annotation on the application GeodeConfig class.

In addition, it appears you are using client PROXY Regions given the declaration of the @EnableEntityDefinedRegions annotation, also declared on the GeodeConfig class, using the provided defaults (e.g. clientRegionShortcut, which defaults to ClientRegionShortcut.PROXY).

At 1 time, the default implementation of the CrudRepository.deleteAll() method, provided by SDG's SimpleGemfireRepository.deleteAll() method, used to be implemented with Region.clear().

As the Javadoc for Region.clear() states, the method throws an UnsupportedOperationException for PARTITION Regions (PR), at least until GEODE-788 is implemented and resolved.

Given the limitation with the PR clear() operation in Apache Geode itself, since SGF-357, SDG has implemented CrudRepository.deleteAll() with Region.removeAll(keys), see here, then here.

However, this implementation currently fails to take into account that the Region.removeAll(keys) operation maybe invoked from a client PROXY Region, which has no keys, ever.

What is technically required, specifically in the client-side PROXY Region case, is...

region.removeAll(region.keySetOnServer())

Without breaking the applications that are server-side.

This Issue is only a problem for PARTITION Regions on the server-side. Both LOCAL and REPLICATE server-side Regions function correctly.

@jxblum jxblum added bug in-progress Work is in-progress. and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 2, 2021
@jxblum jxblum closed this as completed in 41bda1f Jun 2, 2021
jxblum added a commit to jxblum/spring-data-geode that referenced this issue Jun 3, 2021
…er topology with a server-side PARTITION Region.

Resolves spring-projectsgh-512.
jxblum added a commit to jxblum/spring-data-geode that referenced this issue Jun 3, 2021
…er topology with a server-side PARTITION Region.

Resolves spring-projectsgh-512.
@jxblum
Copy link
Contributor

jxblum commented Jun 3, 2021

I will be back porting this fix to SDG Pascal / 2.5, Ockham / 2.4 and Neumann / 2.3.

jxblum added a commit to jxblum/spring-data-geode that referenced this issue Jun 3, 2021
…er topology with a server-side PARTITION Region.

Resolves spring-projectsgh-512.
jxblum added a commit to jxblum/spring-data-geode that referenced this issue Jun 3, 2021
…er topology with a server-side PARTITION Region.

Resolves spring-projectsgh-512.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug in-progress Work is in-progress.
Projects
None yet
Development

No branches or pull requests

3 participants