Skip to content
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

upgrade store version due to read frequency of property key #1341

Merged
merged 4 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public String version() {
* [1.7] #691: support aggregate property
* [1.8] #746: support userdata for indexlabel
* [1.9] #295: support ttl for vertex and edge
* [1.10] #1333: support read frequency for property key
*/
return "1.9";
return "1.10";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -483,16 +483,16 @@ public VertexLabel readVertexLabel(HugeGraph graph,

TableBackendEntry entry = this.convertEntry(backendEntry);

Number id = entry.column(HugeKeys.ID);
String name = entry.column(HugeKeys.NAME);
Number idStrategy = entry.column(HugeKeys.ID_STRATEGY);
Object properties = entry.column(HugeKeys.PROPERTIES);
Object primaryKeys = entry.column(HugeKeys.PRIMARY_KEYS);
Object nullableKeys = entry.column(HugeKeys.NULLABLE_KEYS);
Object indexLabels = entry.column(HugeKeys.INDEX_LABELS);
Number status = entry.column(HugeKeys.STATUS);
Number ttl = entry.column(HugeKeys.TTL);
Number ttlStartTime = entry.column(HugeKeys.TTL_START_TIME);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
Number idStrategy = schemaColumn(entry, HugeKeys.ID_STRATEGY);
Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
Object primaryKeys = schemaColumn(entry, HugeKeys.PRIMARY_KEYS);
Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
Object indexLabels = schemaColumn(entry, HugeKeys.INDEX_LABELS);
Number status = schemaColumn(entry, HugeKeys.STATUS);
Number ttl = schemaColumn(entry, HugeKeys.TTL);
Number ttlStartTime = schemaColumn(entry, HugeKeys.TTL_START_TIME);

VertexLabel vertexLabel = new VertexLabel(graph, this.toId(id), name);
vertexLabel.idStrategy(SerialEnum.fromCode(IdStrategy.class,
Expand All @@ -518,18 +518,18 @@ public EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry backendEntry) {

TableBackendEntry entry = this.convertEntry(backendEntry);

Number id = entry.column(HugeKeys.ID);
String name = entry.column(HugeKeys.NAME);
Number frequency = entry.column(HugeKeys.FREQUENCY);
Number sourceLabel = entry.column(HugeKeys.SOURCE_LABEL);
Number targetLabel = entry.column(HugeKeys.TARGET_LABEL);
Object sortKeys = entry.column(HugeKeys.SORT_KEYS);
Object nullableKeys = entry.column(HugeKeys.NULLABLE_KEYS);
Object properties = entry.column(HugeKeys.PROPERTIES);
Object indexLabels = entry.column(HugeKeys.INDEX_LABELS);
Number status = entry.column(HugeKeys.STATUS);
Number ttl = entry.column(HugeKeys.TTL);
Number ttlStartTime = entry.column(HugeKeys.TTL_START_TIME);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
Number frequency = schemaColumn(entry, HugeKeys.FREQUENCY);
Number sourceLabel = schemaColumn(entry, HugeKeys.SOURCE_LABEL);
Number targetLabel = schemaColumn(entry, HugeKeys.TARGET_LABEL);
Object sortKeys = schemaColumn(entry, HugeKeys.SORT_KEYS);
Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
Object indexLabels = schemaColumn(entry, HugeKeys.INDEX_LABELS);
Number status = schemaColumn(entry, HugeKeys.STATUS);
Number ttl = schemaColumn(entry, HugeKeys.TTL);
Number ttlStartTime = schemaColumn(entry, HugeKeys.TTL_START_TIME);

EdgeLabel edgeLabel = new EdgeLabel(graph, this.toId(id), name);
edgeLabel.frequency(SerialEnum.fromCode(Frequency.class,
Expand Down Expand Up @@ -558,14 +558,14 @@ public PropertyKey readPropertyKey(HugeGraph graph,

TableBackendEntry entry = this.convertEntry(backendEntry);

Number id = entry.column(HugeKeys.ID);
String name = entry.column(HugeKeys.NAME);
Number dataType = entry.column(HugeKeys.DATA_TYPE);
Number cardinality = entry.column(HugeKeys.CARDINALITY);
Number aggregateType = entry.column(HugeKeys.AGGREGATE_TYPE);
Number readFrequency = entry.column(HugeKeys.READ_FREQUENCY);
Object properties = entry.column(HugeKeys.PROPERTIES);
Number status = entry.column(HugeKeys.STATUS);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
Number dataType = schemaColumn(entry, HugeKeys.DATA_TYPE);
Number cardinality = schemaColumn(entry, HugeKeys.CARDINALITY);
Number aggregateType = schemaColumn(entry, HugeKeys.AGGREGATE_TYPE);
Number readFrequency = schemaColumn(entry, HugeKeys.READ_FREQUENCY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to deal with can't get version-info from old version backend

Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
Number status = schemaColumn(entry, HugeKeys.STATUS);

PropertyKey propertyKey = new PropertyKey(graph, this.toId(id), name);
propertyKey.dataType(SerialEnum.fromCode(DataType.class,
Expand Down Expand Up @@ -610,13 +610,13 @@ public IndexLabel readIndexLabel(HugeGraph graph,

TableBackendEntry entry = this.convertEntry(backendEntry);

Number id = entry.column(HugeKeys.ID);
String name = entry.column(HugeKeys.NAME);
Number baseType = entry.column(HugeKeys.BASE_TYPE);
Number baseValueId = entry.column(HugeKeys.BASE_VALUE);
Number indexType = entry.column(HugeKeys.INDEX_TYPE);
Object indexFields = entry.column(HugeKeys.FIELDS);
Number status = entry.column(HugeKeys.STATUS);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
Number baseType = schemaColumn(entry, HugeKeys.BASE_TYPE);
Number baseValueId = schemaColumn(entry, HugeKeys.BASE_VALUE);
Number indexType = schemaColumn(entry, HugeKeys.INDEX_TYPE);
Object indexFields = schemaColumn(entry, HugeKeys.FIELDS);
Number status = schemaColumn(entry, HugeKeys.STATUS);

IndexLabel indexLabel = new IndexLabel(graph, this.toId(id), name);
indexLabel.baseType(SerialEnum.fromCode(HugeType.class,
Expand Down Expand Up @@ -669,7 +669,8 @@ protected void writeEnableLabelIndex(SchemaLabel schema,

protected void readEnableLabelIndex(SchemaLabel schema,
TableBackendEntry entry) {
Boolean enableLabelIndex = entry.column(HugeKeys.ENABLE_LABEL_INDEX);
Boolean enableLabelIndex = schemaColumn(entry,
HugeKeys.ENABLE_LABEL_INDEX);
schema.enableLabelIndex(enableLabelIndex);
}

Expand All @@ -678,4 +679,13 @@ protected abstract void writeUserdata(SchemaElement schema,

protected abstract void readUserdata(SchemaElement schema,
TableBackendEntry entry);

private static <T> T schemaColumn(TableBackendEntry entry, HugeKeys key) {
assert entry.type().isSchema();

T column = entry.column(key);
E.checkState(column != null, "Not found key '%s' from entry %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap line before message

key, entry);
return column;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public String version() {
* [1.4] #746: support userdata for indexlabel
* [1.5] #820: store vertex properties in one column
* [1.6] #894: encode label id in string index
* [1.7] #1333: support read frequency for property key
*/
return "1.5";
return "1.7";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public String version() {
* [1.8] #820: store vertex properties in one column
* [1.9] #894: encode label id in string index
* [1.10] #295: support ttl for vertex and edge
* [1.11] #1333: support read frequency for property key
*/
return "1.10";
return "1.11";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public String version() {
* [1.8] #894: asStoredString() encoding is changed to signed B64
* instead of sortable B64
* [1.9] #295: support ttl for vertex and edge
* [1.10] #1333: support read frequency for property key
*/
return "1.9";
return "1.10";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public String version() {
* [1.7] #894: asStoredString() encoding is changed to signed B64
* instead of sortable B64
* [1.8] #295: support ttl for vertex and edge
* [1.9] #1333: support read frequency for property key
*/
return "1.8";
return "1.9";
}

public static class PaloSchemaStore extends PaloStore {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public String version() {
* [1.6] #894: asStoredString() encoding is changed to signed B64
* instead of sortable B64
* [1.7] #295: support ttl for vertex and edge
* [1.8] #1333: support read frequency for property key
*/
return "1.7";
return "1.8";
}

public static class PostgresqlSchemaStore extends PostgresqlStore {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public String version() {
* [1.7] #820: store vertex properties in one column
* [1.8] #894: encode label id in string index
* [1.9] #295: support ttl for vertex and edge
* [1.10] #1333: support read frequency for property key
*/
return "1.9";
return "1.10";
}
}