Anonymous avatar Anonymous committed 36389f7

Cleanup from 5025, allow recovering nodes to pull immediately

Comments (0)

Files changed (2)


 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
     public static final MigrationManager instance = new MigrationManager();
+    private static final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
+    public static final int MIGRATION_DELAY_IN_MS = 60000;
     private final List<IMigrationListener> listeners = new CopyOnWriteArrayList<IMigrationListener>();
     private MigrationManager() {}
         if (Schema.instance.getVersion().equals(theirVersion))
-        if (Schema.emptyVersion.equals(Schema.instance.getVersion()))
+        if (Schema.emptyVersion.equals(Schema.instance.getVersion()) || runtimeMXBean.getUptime() < MIGRATION_DELAY_IN_MS)
-            // If we think we may be bootstrapping, submit MigrationTask immediately
+            // If we think we may be bootstrapping or have recently started, submit MigrationTask immediately
-            StorageService.optionalTasks.schedule(runnable, 1, TimeUnit.MINUTES);
+            StorageService.optionalTasks.schedule(runnable, MIGRATION_DELAY_IN_MS, TimeUnit.MILLISECONDS);


         // gossip snitch infos (local DC and rack)
         // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
-        Schema.instance.updateVersion(); // Ensure we know our own actual Schema UUID in preparation for updates
-        MigrationManager.passiveAnnounce(Schema.emptyVersion);
+        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema UUID in preparation for updates
         // add rpc listening info
         Gossiper.instance.addLocalApplicationState(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
         if (0 != DatabaseDescriptor.getReplaceTokens().size())
-        MigrationManager.passiveAnnounce(Schema.instance.getVersion());
         Gossiper.instance.addLocalApplicationState(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.