Skip to content

Commit

Permalink
delete ScyllaDB label index tables (#717)
Browse files Browse the repository at this point in the history
related: #455

Change-Id: I1978174e2fbf0ddb64e3d3bdee1a747216fc038f
  • Loading branch information
javeme authored and zhoney committed Oct 25, 2019
1 parent fbbfc83 commit cf15cc3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 671 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public Set<Id> ids() {
}

public String page() {
if (this.pageState == null) {
return null;
}
return this.pageState.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public String toString() {
return toString(this.toBytes());
}

public byte[] toBytes() {
private byte[] toBytes() {
assert this.position.length > 0;
int length = 2 + this.position.length + 2 * BytesBuffer.INT_LEN;
BytesBuffer buffer = BytesBuffer.allocate(length);
buffer.writeBytes(this.position);
Expand All @@ -78,7 +79,7 @@ public static PageState fromString(String page) {
public static PageState fromBytes(byte[] bytes) {
if (bytes.length == 0) {
// The first page
return new PageState(new byte[0], 0, 0);
return EMPTY;
}
try {
BytesBuffer buffer = BytesBuffer.wrap(bytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected boolean fetch() {

@Override
protected PageState pageState() {
return null;
return PageState.EMPTY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ private PageIds doIndexQueryOnce(IndexLabel indexLabel,
}
// NOTE: Memory backend's iterator is not Metadatable
if (!query.paging()) {
return new PageIds(ids, (PageState) null);
return new PageIds(ids, PageState.EMPTY);
}
E.checkState(entries instanceof Metadatable,
"The entries must be Metadatable when query " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@

public class ScyllaDBStoreProvider extends CassandraStoreProvider {

// TODO: read ScyllaDB version from conf
public static int VERSION = 20;

private static final Logger LOG = Log.logger(CassandraStore.class);

private static final BackendFeatures FEATURES = new ScyllaDBFeatures();
Expand Down Expand Up @@ -83,25 +80,14 @@ public ScyllaDBSchemaStore(BackendStoreProvider provider,
String keyspace, String store) {
super(provider, keyspace, store);

if (VERSION >= 20) {
registerTableManager(HugeType.VERTEX_LABEL,
new ScyllaDBTablesWithMV.VertexLabel());
registerTableManager(HugeType.EDGE_LABEL,
new ScyllaDBTablesWithMV.EdgeLabel());
registerTableManager(HugeType.PROPERTY_KEY,
new ScyllaDBTablesWithMV.PropertyKey());
registerTableManager(HugeType.INDEX_LABEL,
new ScyllaDBTablesWithMV.IndexLabel());
} else {
registerTableManager(HugeType.VERTEX_LABEL,
new ScyllaDBTables.VertexLabel());
registerTableManager(HugeType.EDGE_LABEL,
new ScyllaDBTables.EdgeLabel());
registerTableManager(HugeType.PROPERTY_KEY,
new ScyllaDBTables.PropertyKey());
registerTableManager(HugeType.INDEX_LABEL,
new ScyllaDBTables.IndexLabel());
}
registerTableManager(HugeType.VERTEX_LABEL,
new ScyllaDBTablesWithMV.VertexLabel());
registerTableManager(HugeType.EDGE_LABEL,
new ScyllaDBTablesWithMV.EdgeLabel());
registerTableManager(HugeType.PROPERTY_KEY,
new ScyllaDBTablesWithMV.PropertyKey());
registerTableManager(HugeType.INDEX_LABEL,
new ScyllaDBTablesWithMV.IndexLabel());
}

@Override
Expand All @@ -117,21 +103,12 @@ public ScyllaDBGraphStore(BackendStoreProvider provider,
String keyspace, String store) {
super(provider, keyspace, store);

if (VERSION >= 20) {
registerTableManager(HugeType.VERTEX,
new ScyllaDBTablesWithMV.Vertex(store));
registerTableManager(HugeType.EDGE_OUT,
ScyllaDBTablesWithMV.Edge.out(store));
registerTableManager(HugeType.EDGE_IN,
ScyllaDBTablesWithMV.Edge.in(store));
} else {
registerTableManager(HugeType.VERTEX,
new ScyllaDBTables.Vertex(store));
registerTableManager(HugeType.EDGE_OUT,
ScyllaDBTables.Edge.out(store));
registerTableManager(HugeType.EDGE_IN,
ScyllaDBTables.Edge.in(store));
}
registerTableManager(HugeType.VERTEX,
new ScyllaDBTablesWithMV.Vertex(store));
registerTableManager(HugeType.EDGE_OUT,
ScyllaDBTablesWithMV.Edge.out(store));
registerTableManager(HugeType.EDGE_IN,
ScyllaDBTablesWithMV.Edge.in(store));
}

@Override
Expand Down
Loading

0 comments on commit cf15cc3

Please sign in to comment.