public void start() {
super.start();
final boolean clearIncompatibleData = Boolean.parseBoolean(config.getProperty(CLEAR_INCOMPATIBLE_DATA_PROP));
initSchemaManagerDirectory();
this.memoryTableAIS = new AkibanInformationSchema();
this.tableStatusCache = new FDBTableStatusCache(holder, txnService);
try(Session session = sessionService.createSession()) {
txnService.run(session, new Runnable() {
@Override
public void run() {
TransactionState txn = txnService.getTransaction(session);
Boolean isCompatible = isDataCompatible(txn, false);
if(isCompatible == Boolean.FALSE) {
if(!clearIncompatibleData) {
isDataCompatible(txn, true);
assert false; // Throw expected
}
LOG.warn("Clearing incompatible data directory: {}", rootDir.getPath());
// Delicate: Directory removal is safe as this is the first service started that consumes it.
// Remove after the 1.9.2 release, which includes entry point for doing this.
rootDir.remove(txn.getTransaction()).get();
initSchemaManagerDirectory();
isCompatible = null;
}
if(isCompatible == null) {
saveInitialState(txn);
}
AkibanInformationSchema newAIS = loadFromStorage(session);
buildRowDefs(session, newAIS);
FDBSchemaManager.this.curAIS = newAIS;
}
});