Skip to content

Conversation

@albertZhangTJ
Copy link
Collaborator

In Postgres, each REINDEX statement can only work on one index, as can be seen here.

The previous edition will instead generate all index names, concatenated without delimiter.

throw new IgnoreMeException();
}
sb.append(indexes.stream().map(i -> i.getIndexName()).collect(Collectors.joining()));
sb.append(indexes.stream().skip(Randomly.getNotCachedInteger(0, indexes.size())).findFirst().map(i -> i.getIndexName()).orElse(""));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That looks quite complex. Could we use the Randomly class to get a random element of the indexes list and obtain the name of the index?

Also, I think we should investigate why this code currently does not trigger any bugs. There might be a more fundamental issue. For example, do we only generate one index at most?

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

Successfully merging this pull request may close these issues.

2 participants