-
Notifications
You must be signed in to change notification settings - Fork 11
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
Issue 1415 - DynamoDB store for table names & IDs #1418
Conversation
java/configuration/src/main/java/sleeper/configuration/properties/instance/CommonProperty.java
Outdated
Show resolved
Hide resolved
# Conflicts: # java/configuration/src/main/java/sleeper/configuration/properties/instance/CommonProperty.java # java/configuration/src/test/java/sleeper/configuration/properties/InstancePropertiesTestHelper.java
|
||
import java.util.Objects; | ||
|
||
public class TableId { |
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.
Is this the right name for this class, given it contains a field called tableId
? It means that TableIndex
has the method Optional<TableId> getTableById(String tableId);
which looks wrong. Could call this class TableIdAndName
? Alternatively rename the field tableId
to tableUniqueId
and then the method on TableIndex
would be Optional<TableId> getTableByUniqueId(String tableUniqueId);
?
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've renamed the field, thanks.
@Test | ||
void shouldGenerate32BitHexId() { | ||
assertThat(TableIdGenerator.fromRandomSeed(0).generateString()) | ||
.isEqualTo("60b420bb"); |
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.
Is it worth testing that a second call to the same TableIdGenerator
gives a different string to the first one? There's nothing to stop someone reusing the same TableIdGenerator
many times.
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
.withExpressionAttributeNames(Map.of("#tablename", TABLE_NAME_FIELD))), | ||
new TransactWriteItem().withPut(new Put() | ||
.withTableName(idIndexDynamoTableName) | ||
.withItem(DynamoDBTableIdFormat.getItem(id)) |
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.
As DynamoDBTableIdFormat.getItem(id)
is used twice, I think it would be better to calculate it once and re-use it.
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 Stream<TableId> streamAllTables() { | ||
return streamPagedItems(dynamoDB, new ScanRequest().withTableName(nameIndexDynamoTableName)) |
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.
We should probably use strongly consistent reads.
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
# Conflicts: # example/full/instance.properties # scripts/templates/instanceproperties.template
Make sure you have checked all steps below.
Issue
PR"
Tests
Documentation
separate issue for that below.
NOTICES file to reflect this.