-
Notifications
You must be signed in to change notification settings - Fork 627
add update time to FieldIndex #2984
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
Conversation
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (38d628d2) is created by Prow via merging commits: e445aca ceb3121. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (38d628d2) is created by Prow via merging commits: e445aca ceb3121. |
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.
Some feedback. Please send to @wu-hui if you have updates by Monday.
public FieldIndex decodeFieldIndex(String collection_group, int indexId, Index index) { | ||
FieldIndex fieldIndex = new FieldIndex(collection_group, indexId); | ||
public FieldIndex decodeFieldIndex( | ||
String collectionGroup, int indexId, Index index, int updateSeconds, int updateNanos) { |
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.
Please use SnapshotVersion for seconds+nanos.
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.
done.
result = 31 * result + segments.hashCode(); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("FieldIndex{collectionId='%s', segments=%s}", collectionId, segments); | ||
return String.format( | ||
"FieldIndex{collectionGroup='%s', segments=%s}", collectionGroup, segments); |
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.
updateTime?
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.
done.
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = collectionId.hashCode(); | ||
int result = collectionGroup.hashCode(); |
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.
updateTime?
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.
done.
@@ -118,18 +131,19 @@ public boolean equals(Object o) { | |||
FieldIndex fieldIndex = (FieldIndex) o; | |||
|
|||
if (!segments.equals(fieldIndex.segments)) return false; | |||
return collectionId.equals(fieldIndex.collectionId); | |||
return collectionGroup.equals(fieldIndex.collectionGroup); |
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.
updateTime?
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.
done.
assertEquals(indexes.size(), 1); | ||
FieldIndex index = indexes.get(0); | ||
assertEquals(index.getUpdateTime(), new Timestamp(10, 20)); | ||
} |
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.
This test seems better suited for our serialization tests.
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.
The test here checks that the persistence queries in addFieldIndex
and getFieldIndex
are correct.
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.
thanks for the speedy review!
public FieldIndex decodeFieldIndex(String collection_group, int indexId, Index index) { | ||
FieldIndex fieldIndex = new FieldIndex(collection_group, indexId); | ||
public FieldIndex decodeFieldIndex( | ||
String collectionGroup, int indexId, Index index, int updateSeconds, int updateNanos) { |
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.
done.
@@ -118,18 +131,19 @@ public boolean equals(Object o) { | |||
FieldIndex fieldIndex = (FieldIndex) o; | |||
|
|||
if (!segments.equals(fieldIndex.segments)) return false; | |||
return collectionId.equals(fieldIndex.collectionId); | |||
return collectionGroup.equals(fieldIndex.collectionGroup); |
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.
done.
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = collectionId.hashCode(); | ||
int result = collectionGroup.hashCode(); |
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.
done.
result = 31 * result + segments.hashCode(); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("FieldIndex{collectionId='%s', segments=%s}", collectionId, segments); | ||
return String.format( | ||
"FieldIndex{collectionGroup='%s', segments=%s}", collectionGroup, segments); |
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.
done.
assertEquals(indexes.size(), 1); | ||
FieldIndex index = indexes.get(0); | ||
assertEquals(index.getUpdateTime(), new Timestamp(10, 20)); | ||
} |
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.
The test here checks that the persistence queries in addFieldIndex
and getFieldIndex
are correct.
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.
@thebrianchen You replied some comments, but the actual changes are not applied it seems. Did you forget to push a new commit?
List<FieldIndex> allIndexes = new ArrayList<>(); | ||
db.query( | ||
"SELECT index_id, collection_group, index_proto, update_time_seconds, update_time_nanos FROM index_configuration " | ||
+ "WHERE active") |
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 WHERE active
actually work? And even if it works, we should still be using active = 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.
Thanks for catching. SQL query still works without adding = 1
, but it's best to follow best practices.
@thebrianchen: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Incremental PR to add storing and retrieving last update time from FieldIndex. Also renamed collectionId to collectionGroup on fieldIndex.