-
Notifications
You must be signed in to change notification settings - Fork 29
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
Conversation
…eKeyValueAdapter as unused
…ls.IndexExists(), partial rollback in IndexUtils to support Server versions prior to 6.1.0.1
There was a problem hiding this 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
src/test/java/org/springframework/data/aerospike/IndexUtils.java
Outdated
Show resolved
Hide resolved
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"); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
src/main/java/org/springframework/data/aerospike/core/AerospikeTemplate.java
Outdated
Show resolved
Hide resolved
src/main/java/org/springframework/data/aerospike/core/AerospikeTemplate.java
Outdated
Show resolved
Hide resolved
src/main/java/org/springframework/data/aerospike/core/AerospikeTemplate.java
Show resolved
Hide resolved
src/main/java/org/springframework/data/aerospike/IndexAlreadyExistsException.java
Show resolved
Hide resolved
return false; | ||
} else { | ||
String regex = "^FAIL:(-?\\d+).*$"; | ||
Matcher matcher = Pattern.compile(regex).matcher(response); |
There was a problem hiding this comment.
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.
…eTemplate.java Co-authored-by: Eugene R. <[email protected]>
try { | ||
Node[] nodes = reactorClient.getAerospikeClient().getNodes(); | ||
for (Node node : nodes) { | ||
String response = Info.request(node, "sindex-exists:ns=" + namespace + ";indexname=" + indexName); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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)
No description provided.