Add debug logging to help diagnose intermittent upgrade test failures.
Also fixed indentation in ElasticsearchMergePolicy.
This commit is contained in:
parent
516b87e129
commit
5ed193086d
|
@ -31,6 +31,8 @@ import org.apache.lucene.util.packed.GrowableWriter;
|
|||
import org.apache.lucene.util.packed.PackedInts;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Numbers;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
|
||||
import org.elasticsearch.index.mapper.internal.VersionFieldMapper;
|
||||
|
||||
|
@ -54,6 +56,8 @@ import java.util.Map;
|
|||
*/
|
||||
public final class ElasticsearchMergePolicy extends MergePolicy {
|
||||
|
||||
private static ESLogger logger = Loggers.getLogger(ElasticsearchMergePolicy.class);
|
||||
|
||||
private final MergePolicy delegate;
|
||||
private volatile boolean upgradeInProgress;
|
||||
private static final int MAX_CONCURRENT_UPGRADE_MERGES = 5;
|
||||
|
@ -208,16 +212,19 @@ public final class ElasticsearchMergePolicy extends MergePolicy {
|
|||
cur.major == old.major && cur.minor > old.minor) {
|
||||
// TODO: Use IndexUpgradeMergePolicy instead. We should be comparing codecs,
|
||||
// for now we just assume every minor upgrade has a new format.
|
||||
logger.debug("Adding segment " + info.info.name + " to be upgraded");
|
||||
spec.add(new OneMerge(Lists.newArrayList(info)));
|
||||
}
|
||||
if (spec.merges.size() == MAX_CONCURRENT_UPGRADE_MERGES) {
|
||||
// hit our max upgrades, so return the spec. we will get a cascaded call to continue.
|
||||
logger.debug("Returning " + spec.merges.size() + " merges for upgrade");
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
// We must have less than our max upgrade merges, so the next return will be our last in upgrading mode.
|
||||
upgradeInProgress = false;
|
||||
if (spec.merges.isEmpty() == false) {
|
||||
logger.debug("Return " + spec.merges.size() + " merges for end of upgrade");
|
||||
return spec;
|
||||
}
|
||||
// fall through, so when we don't have any segments to upgrade, the delegate policy
|
||||
|
|
|
@ -121,6 +121,8 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
|
|||
assertNotUpgraded(httpClient, null);
|
||||
final String indexToUpgrade = "test" + randomInt(numIndexes - 1);
|
||||
|
||||
logger.debug("Running upgrade on index " + indexToUpgrade);
|
||||
logClusterState();
|
||||
runUpgrade(httpClient, indexToUpgrade);
|
||||
awaitBusy(new Predicate<Object>() {
|
||||
@Override
|
||||
|
@ -132,8 +134,14 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
|
|||
}
|
||||
}
|
||||
});
|
||||
logger.debug("Single index upgrade complete");
|
||||
logClusterState();
|
||||
|
||||
logger.debug("Running upgrade on the rest of the indexes");
|
||||
logClusterState();
|
||||
runUpgrade(httpClient, null, "wait_for_completion", "true");
|
||||
logger.debug("Full upgrade complete");
|
||||
logClusterState();
|
||||
assertUpgraded(httpClient, null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue