Search in sources :

Example 6 with CassandraVersion

use of org.apache.cassandra.utils.CassandraVersion in project cassandra by apache.

the class SSTableHeaderFix method fixNonFrozenUDTIfUpgradeFrom30.

public static void fixNonFrozenUDTIfUpgradeFrom30() {
    String previousVersionString = FBUtilities.getPreviousReleaseVersionString();
    if (previousVersionString == null)
        return;
    CassandraVersion previousVersion = new CassandraVersion(previousVersionString);
    if (previousVersion.major != 3 || previousVersion.minor > 0) {
        // Not an upgrade from 3.0 to 3.x, nothing to do here
        return;
    }
    if (SKIP_AUTOMATIC_FIX_ON_UPGRADE) {
        logger.warn("Detected upgrade from {} to {}, but -D{}=true, NOT fixing UDT type references in " + "sstable metadata serialization-headers", previousVersionString, FBUtilities.getReleaseVersionString(), SKIPAUTOMATICUDTFIX);
        return;
    }
    logger.info("Detected upgrade from {} to {}, fixing UDT type references in sstable metadata serialization-headers", previousVersionString, FBUtilities.getReleaseVersionString());
    SSTableHeaderFix instance = SSTableHeaderFix.builder().schemaCallback(() -> Schema.instance::getTableMetadata).build();
    instance.execute();
}
Also used : Schema(org.apache.cassandra.schema.Schema) CassandraVersion(org.apache.cassandra.utils.CassandraVersion)

Example 7 with CassandraVersion

use of org.apache.cassandra.utils.CassandraVersion in project cassandra by apache.

the class Gossiper method computeMinVersion.

private CassandraVersion computeMinVersion() {
    CassandraVersion minVersion = null;
    for (InetAddressAndPort addr : Iterables.concat(Gossiper.instance.getLiveMembers(), Gossiper.instance.getUnreachableMembers())) {
        String versionString = getReleaseVersionString(addr);
        // Raced with changes to gossip state, wait until next iteration
        if (versionString == null)
            return null;
        CassandraVersion version;
        try {
            version = new CassandraVersion(versionString);
        } catch (Throwable t) {
            JVMStabilityInspector.inspectThrowable(t);
            String message = String.format("Can't parse version string %s", versionString);
            logger.warn(message);
            if (logger.isDebugEnabled())
                logger.debug(message, t);
            return null;
        }
        if (minVersion == null || version.compareTo(minVersion) < 0)
            minVersion = version;
    }
    return minVersion;
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) CassandraVersion(org.apache.cassandra.utils.CassandraVersion)

Aggregations

CassandraVersion (org.apache.cassandra.utils.CassandraVersion)7 ClientState (org.apache.cassandra.service.ClientState)2 Test (org.junit.Test)2 BoundStatement (com.datastax.driver.core.BoundStatement)1 Cluster (com.datastax.driver.core.Cluster)1 Host (com.datastax.driver.core.Host)1 PreparedStatement (com.datastax.driver.core.PreparedStatement)1 PreparedStatementHelper (com.datastax.driver.core.PreparedStatementHelper)1 Session (com.datastax.driver.core.Session)1 InvalidQueryException (com.datastax.driver.core.exceptions.InvalidQueryException)1 ImmutableList (com.google.common.collect.ImmutableList)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Random (java.util.Random)1 Set (java.util.Set)1