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

Add system schema store #1891

Merged
merged 7 commits into from
Jun 2, 2022
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 @@ -782,10 +782,6 @@ public void removeOlapTable(Id id) {
table.dropTable(this.session());
this.unregisterTableManager(name);
}

public CassandraSessionPool.Session getSession() {
return super.sessions.session();
}
}

public static class CassandraSystemStore extends CassandraGraphStore {
Expand All @@ -803,16 +799,15 @@ public CassandraSystemStore(BackendStoreProvider provider,
public void init() {
super.init();
this.checkOpened();
CassandraSessionPool.Session session = this.getSession();
String driverVersion = this.provider().driverVersion();
this.meta.writeVersion(session, driverVersion);
this.meta.writeVersion(this.session(), driverVersion);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "this.checkOpened()" since called in this.session()

LOG.info("Write down the backend version: {}", driverVersion);
}

@Override
public String storedVersion() {
this.checkOpened();
CassandraSessionPool.Session session = this.getSession();
CassandraSessionPool.Session session = this.session();
return this.meta.readVersion(session);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public interface HugeGraph extends Graph {

GraphReadMode readMode();


void readMode(GraphReadMode readMode);

void waitReady(RpcServer rpcServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
public interface AuthManager {

void init();
zyxxoo marked this conversation as resolved.
Show resolved Hide resolved

boolean close();

Id createUser(HugeUser user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class VertexLabel extends SchemaLabel {
// OLAP_VL_ID means all of vertex label ids
private static final Id OLAP_VL_ID = IdGenerator.of(SchemaLabel.OLAP_VL_ID);
// OLAP_VL_NAME means all of vertex label names
private static final String OLAP_VL_NAME = "olap";
private static final String OLAP_VL_NAME = "*olap";
// OLAP_VL means all of vertex labels
public static final VertexLabel OLAP_VL = new VertexLabel(null, OLAP_VL_ID,
OLAP_VL_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,6 @@ public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
"HbaseGraphStore.getCounter()");
}

public Session getSession() {
return super.sessions.session();
}
}

public static class HbaseSystemStore extends HbaseGraphStore {
Expand All @@ -578,7 +574,7 @@ protected List<String> tableNames() {
public void init() {
super.init();
super.checkOpened();
Session session = super.getSession();
Session session = super.sessions.session();
Copy link
Contributor

Choose a reason for hiding this comment

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

can call this.session(null), and we can also replace the following code with
Session session = this.session(null) like line 228,477:

this.checkOpened();
Session session = this.sessions.session();

String driverVersion = this.provider().driverVersion();
this.meta.writeVersion(session, driverVersion);
LOG.info("Write down the backend version: {}", driverVersion);
Expand All @@ -587,7 +583,7 @@ public void init() {
@Override
public String storedVersion() {
super.checkOpened();
Session session = super.getSession();
Session session = super.sessions.session();
return this.meta.readVersion(session);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,6 @@ public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
"MysqlGraphStore.getCounter()");
}

public Session getSession() {
return super.sessions.session();
}
}

public static class MysqlSystemStore extends MysqlGraphStore {
Expand All @@ -492,7 +488,7 @@ public MysqlSystemStore(BackendStoreProvider provider,
public void init() {
super.init();
this.checkOpened();
Session session = this.getSession();
Session session = super.sessions.session();
String driverVersion = this.provider().driverVersion();
this.meta.writeVersion(session, driverVersion);
LOG.info("Write down the backend version: {}", driverVersion);
Expand All @@ -502,7 +498,7 @@ public void init() {
public String storedVersion() {
super.init();
this.checkOpened();
Session session = this.getSession();
Session session = super.sessions.session();
return this.meta.readVersion(session);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1095,10 +1095,6 @@ public void removeOlapTable(Id id) {
this.dropTable(db, table.table());
this.unregisterTableManager(this.olapTableName(id));
}

public Session getSession() {
return super.sessions.session();
}
}

public static class RocksDBSystemStore extends RocksDBGraphStore {
Expand All @@ -1118,8 +1114,7 @@ public synchronized void init() {
Lock writeLock = this.storeLock().writeLock();
writeLock.lock();
try {
super.checkOpened();
Session session = super.getSession();
Session session = super.sessions.session();
Copy link
Contributor

Choose a reason for hiding this comment

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

can call this.session(HugeType.META)

String driverVersion = this.provider().driverVersion();
this.meta.writeVersion(session, driverVersion);
LOG.info("Write down the backend version: {}", driverVersion);
Expand All @@ -1134,7 +1129,7 @@ public String storedVersion() {
readLock.lock();
try {
super.checkOpened();
Session session = super.getSession();
Session session = super.sessions.session();
return this.meta.readVersion(session);
} finally {
readLock.unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
PageStateTest.class,
SystemSchemaStoreTest.class,

/* serializer */
/* serializer */
BytesBufferTest.class,
SerializerFactoryTest.class,
TextBackendEntryTest.class,
Expand Down