Revert "fix(namespace): stop the backfill from querying with a null keyword"

This reverts commit 639e081ca7.
This commit is contained in:
XiaoSeS 2026-08-28 15:19:56 +08:00
parent e80fb986f7
commit fbf6887e9d
3 changed files with 2 additions and 13 deletions

View file

@ -141,7 +141,7 @@ public class PersonalNamespaceProvisioningService {
boolean truncated = false;
for (int page = 0; !truncated; page++) {
Page<UserAccount> batch = userAccountRepository.findByStatus(UserStatus.ACTIVE,
Page<UserAccount> batch = userAccountRepository.search(null, UserStatus.ACTIVE,
PageRequest.of(page, BACKFILL_PAGE_SIZE, Sort.by("id")));
if (batch.isEmpty()) {
break;

View file

@ -14,16 +14,5 @@ public interface UserAccountRepository {
List<UserAccount> findByIdIn(List<String> ids);
Optional<UserAccount> findByEmailIgnoreCase(String email);
Page<UserAccount> search(String keyword, UserStatus status, Pageable pageable);
/**
* Lists accounts in one status.
*
* <p>Separate from {@link #search} on purpose: that query compares the keyword with
* {@code lower(...)}, and passing a null keyword leaves PostgreSQL to infer the bind type as
* {@code bytea}, which fails with "function lower(bytea) does not exist". Callers that want
* every account in a status have no keyword to give, so they get a query without one.
*/
Page<UserAccount> findByStatus(UserStatus status, Pageable pageable);
UserAccount save(UserAccount user);
}

View file

@ -63,7 +63,7 @@ class PersonalNamespaceProvisioningServiceTest {
}
private void directoryContains(UserAccount... users) {
when(userAccountRepository.findByStatus(eq(UserStatus.ACTIVE), any()))
when(userAccountRepository.search(isNull(), eq(UserStatus.ACTIVE), any()))
.thenReturn(new PageImpl<>(List.of(users)));
}