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

FMWK-123 Handle new behavior of create / drop secondary index #487

Merged
merged 13 commits into from
Feb 20, 2023

Conversation

agrgr
Copy link

@agrgr agrgr commented Feb 19, 2023

No description provided.

Copy link
Member

@reugn reugn left a comment

Choose a reason for hiding this comment

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

  • Merge in the master branch (the PR contains many changes that are already in the master)
  • Make the necessary changes to the reactive implementation

public static boolean indexExists(IAerospikeClient client, String namespace, String indexName) {
Node node = getNode(client);
String response = Info.request(node, "sindex/" + namespace + '/' + indexName);
return !response.startsWith("FAIL:201");
}

public static String getServerVersion(IAerospikeClient client) {
String versionString = Info.request(null, client.getCluster().getRandomNode(), "version");
Copy link
Member

Choose a reason for hiding this comment

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

Remove the first null parameter

/**
* @deprecated since Aerospike Server ver. 6.1.0.1. Use
* {@link org.springframework.data.aerospike.core.AerospikeTemplate#indexExists(String)}
*/
public static boolean indexExists(IAerospikeClient client, String namespace, String indexName) {
Node node = getNode(client);
Copy link
Member

Choose a reason for hiding this comment

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

Use client.getCluster().getRandomNode() and remove the getNode method.

return false;
} else {
String regex = "^FAIL:(-?\\d+).*$";
Matcher matcher = Pattern.compile(regex).matcher(response);
Copy link
Member

Choose a reason for hiding this comment

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

Compile the pattern once as a static.

try {
Node[] nodes = reactorClient.getAerospikeClient().getNodes();
for (Node node : nodes) {
String response = Info.request(node, "sindex-exists:ns=" + namespace + ";indexname=" + indexName);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see sindex-exists in as-info commands reference: https://docs.aerospike.com/reference/info
Also, we need to verify whether this info call is a node level or a cluster level (your code assumes its a node level info call but I remember that with indexes api it's enough to send as info call to a single node).

Copy link
Author

@agrgr agrgr Feb 20, 2023

Choose a reason for hiding this comment

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

It was done according to Brian's letter (attached as a comment to FMWK-123)

@agrgr agrgr merged commit 4e68b05 into main Feb 20, 2023
@agrgr agrgr deleted the FMWK-123-sindex-exists branch February 20, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants