mirror of https://github.com/apache/cassandra
apply CASSANDRA-987 to thrift.CassandraDaemon too...
...and expect that lastMigration might be null Patch by eevans git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@948929 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c924ce55eb
commit
8c323b80e8
|
|
@ -110,7 +110,7 @@ public class CassandraDaemon {
|
|||
// is to read those migrations from disk and apply them.
|
||||
UUID currentMigration = DatabaseDescriptor.getDefsVersion();
|
||||
UUID lastMigration = Migration.getLastMigrationId();
|
||||
if (lastMigration.timestamp() > currentMigration.timestamp())
|
||||
if ((lastMigration != null) && (lastMigration.timestamp() > currentMigration.timestamp()))
|
||||
{
|
||||
MigrationManager.applyMigrations(currentMigration, lastMigration);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.cassandra.config.ConfigurationException;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -31,6 +32,7 @@ import org.apache.log4j.PropertyConfigurator;
|
|||
|
||||
import org.apache.cassandra.utils.Mx4jTool;
|
||||
import org.apache.cassandra.db.commitlog.CommitLog;
|
||||
import org.apache.cassandra.db.migration.Migration;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.apache.thrift.server.TThreadPoolServer;
|
||||
|
|
@ -40,6 +42,7 @@ import org.apache.thrift.transport.TTransportFactory;
|
|||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.TProcessorFactory;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.service.MigrationManager;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.db.Table;
|
||||
|
|
@ -104,7 +107,17 @@ public class CassandraDaemon
|
|||
// replay the log if necessary and check for compaction candidates
|
||||
CommitLog.recover();
|
||||
CompactionManager.instance.checkAllColumnFamilies();
|
||||
|
||||
|
||||
// check to see if CL.recovery modified the lastMigrationId. if it did, we need to re apply migrations. this isn't
|
||||
// the same as merely reloading the schema (which wouldn't perform file deletion after a DROP). The solution
|
||||
// is to read those migrations from disk and apply them.
|
||||
UUID currentMigration = DatabaseDescriptor.getDefsVersion();
|
||||
UUID lastMigration = Migration.getLastMigrationId();
|
||||
if ((lastMigration != null) && (lastMigration.timestamp() > currentMigration.timestamp()))
|
||||
{
|
||||
MigrationManager.applyMigrations(currentMigration, lastMigration);
|
||||
}
|
||||
|
||||
// start server internals
|
||||
StorageService.instance.initServer();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue