-
Notifications
You must be signed in to change notification settings - Fork 525
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
set indexlabel invalid if create or rebuild failed #1226
Conversation
also check if indexlabel invalid when query by index Change-Id: If890b3bd8c441b63642a2006479cf4ccca9ddf67
Codecov Report
@@ Coverage Diff @@
## master #1226 +/- ##
============================================
- Coverage 65.76% 64.97% -0.79%
- Complexity 5752 5762 +10
============================================
Files 360 367 +7
Lines 29593 30062 +469
Branches 4180 4242 +62
============================================
+ Hits 19462 19533 +71
- Misses 8152 8548 +396
- Partials 1979 1981 +2 Continue to review full report at Codecov.
|
@@ -1349,6 +1354,13 @@ private static NoIndexException noIndexException(HugeGraph graph, | |||
name, String.join("/", mismatched)); | |||
} | |||
|
|||
private static void validIndexLabel(IndexLabel indexLabel) { |
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.
validate
@@ -1349,6 +1354,13 @@ private static NoIndexException noIndexException(HugeGraph graph, | |||
name, String.join("/", mismatched)); | |||
} | |||
|
|||
private static void validIndexLabel(IndexLabel indexLabel) { | |||
if (indexLabel.status() == SchemaStatus.INVALID) { | |||
throw new HugeException("The label index %s is invalid", |
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.
Can't query by label index '%s' due to it is in invalid status
@@ -158,6 +166,9 @@ private void removeIndex(Collection<Id> indexLabelIds) { | |||
try { | |||
locks.lockWrites(LockUtil.INDEX_LABEL_DELETE, indexLabelIds); | |||
graphTx.removeIndex(il); | |||
} catch (Throwable t) { | |||
il.status(SchemaStatus.INVALID); |
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.
does save to backend store? seems need to call schemaTx.updateSchemaStatus()
return new IndexLabel.CreatedIndexLabel(indexLabel, | ||
rebuildTask); | ||
} catch (Throwable t) { | ||
indexLabel.status(SchemaStatus.INVALID); |
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.
ditto
rebuildTask); | ||
} catch (Throwable t) { | ||
indexLabel.status(SchemaStatus.INVALID); | ||
throw t; |
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.
rename t to e
indexLabel.status(SchemaStatus.INVALID); | ||
throw t; | ||
this.graph().addIndexLabel(schemaLabel, indexLabel); |
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.
schemaTx.updateSchemaStatus(indexLabel, SchemaStatus.INVALID);
@@ -231,8 +231,7 @@ private boolean hasSameProperties(IndexLabel existedIndexLabel) { | |||
return new IndexLabel.CreatedIndexLabel(indexLabel, | |||
rebuildTask); | |||
} catch (Throwable e) { | |||
indexLabel.status(SchemaStatus.INVALID); | |||
this.graph().addIndexLabel(schemaLabel, indexLabel); | |||
this.updateSchemaStatus(indexLabel, SchemaStatus.INVALID); |
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.
also consider removeSubIndex() at line 207
} catch (Throwable e) { | ||
schemaTx.updateSchemaStatus(indexLabel, SchemaStatus.INVALID); | ||
throw e; | ||
} |
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.
should update status to INVALID when failure to remove vertex/edge label?
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.
no need. Fail to remove vertex/edge label will lead to partial delete of vertices/edges. vertex/edge label need to be still valid for remaining vertices/edges
removeIndexLabelFromBaseLabel(schemaTx, indexLabel); | ||
removeSchema(schemaTx, indexLabel); | ||
// Should commit changes to backend store | ||
// before release delete lock |
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 "/*"
Change-Id: I7537bd5aff2b43e8a3ba26c88f83761889386ff3
* set indexlabel invalid if create or rebuild failed * also check if indexlabel invalid when query by index * set vl/el to UNDELETED if fail to delete Change-Id: If890b3bd8c441b63642a2006479cf4ccca9ddf67
* set indexlabel invalid if create or rebuild failed * also check if indexlabel invalid when query by index * set vl/el to UNDELETED if fail to delete Change-Id: If890b3bd8c441b63642a2006479cf4ccca9ddf67
also check if indexlabel invalid when query by index
Change-Id: If890b3bd8c441b63642a2006479cf4ccca9ddf67