Skip to content

Commit

Permalink
Bugfix: Ensures that only the default node/relationship attribute ind…
Browse files Browse the repository at this point in the history
…exes are automatically removed (for neo4j v4 and v5) by restricting knowledge of other index types. This is done by adding a where-clause with the default index type to the query where structr gathers information about existing indexes.
  • Loading branch information
vigorouscoding committed Dec 6, 2024
1 parent c772c71 commit d101f95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void updateIndexConfiguration(final Map<String, Map<String, IndexConfig>>

try (final Transaction tx = db.beginTx(timeoutSeconds)) {

tx.prefetchHint("Neo4IndexUpdater update");
tx.prefetchHint("Neo3IndexUpdater update");

if (indexConfig.createOrDropIndex()) {

Expand Down Expand Up @@ -244,7 +244,7 @@ public void updateIndexConfiguration(final Map<String, Map<String, IndexConfig>>

if (indexExists && indexConfig.createOrDropIndex()) {

final AtomicBoolean retry = new AtomicBoolean(true);
final AtomicBoolean retry = new AtomicBoolean(true);
final AtomicInteger retryCount = new AtomicInteger(0);

while (retry.get()) {
Expand All @@ -257,7 +257,7 @@ public void updateIndexConfiguration(final Map<String, Map<String, IndexConfig>>

try (final Transaction tx = db.beginTx(timeoutSeconds)) {

tx.prefetchHint("Neo4IndexUpdater update");
tx.prefetchHint("Neo3IndexUpdater update");

// drop index
db.execute("DROP " + indexDescription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void updateIndexConfiguration(final Map<String, Map<String, IndexConfig>>

tx.prefetchHint("Neo4IndexUpdater query");

for (final Map<String, Object> row : db.execute("CALL db.indexes() YIELD name, type, state, labelsOrTypes, properties RETURN {name: name, type: type, labels: labelsOrTypes, properties: properties, state: state}")) {
for (final Map<String, Object> row : db.execute("CALL db.indexes() YIELD name, type, state, labelsOrTypes, properties WHERE type = 'BTREE' RETURN {name: name, type: type, labels: labelsOrTypes, properties: properties, state: state}")) {

for (final Object value : row.values()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void updateIndexConfiguration(final Map<String, Map<String, IndexConfig>>

tx.prefetchHint("Neo5IndexUpdater query");

for (final Map<String, Object> row : db.execute("SHOW INDEXES YIELD name, type, state, labelsOrTypes, properties RETURN {name: name, type: type, labels: labelsOrTypes, properties: properties, state: state}")) {
for (final Map<String, Object> row : db.execute("SHOW INDEXES YIELD name, type, state, labelsOrTypes, properties WHERE type = 'RANGE' RETURN {name: name, type: type, labels: labelsOrTypes, properties: properties, state: state}")) {

for (final Object value : row.values()) {

Expand Down

0 comments on commit d101f95

Please sign in to comment.