Projects >> elasticsearch >>858610d0d10cd9ac33f3e460528a1f9f80863257

Chunk
Conflicting content
            .numberOfShards(1).numberOfReplicas(0).build();

    public static final String KEY_ACTIVE_ALLOCATIONS = "active_allocations";
<<<<<<< HEAD
    static final String KEY_VERSION = "version";
    static final String KEY_SETTINGS = "settings";
    static final String KEY_STATE = "state";
    static final String KEY_MAPPINGS = "mappings";
    static final String KEY_ALIASES = "aliases";
    static final String KEY_PRIMARY_TERMS = "primary_terms";
=======
    public static final String INDEX_STATE_FILE_PREFIX = "state-";
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca

    private final int numberOfShards;
    private final int numberOfReplicas;
Solution content
            .numberOfShards(1).numberOfReplicas(0).build();

    public static final String KEY_ACTIVE_ALLOCATIONS = "active_allocations";
    public static final String INDEX_STATE_FILE_PREFIX = "state-";

    static final String KEY_VERSION = "version";
    static final String KEY_SETTINGS = "settings";
    static final String KEY_STATE = "state";
    static final String KEY_MAPPINGS = "mappings";
    static final String KEY_ALIASES = "aliases";
    static final String KEY_PRIMARY_TERMS = "primary_terms";

    private final int numberOfShards;
    private final int numberOfReplicas;
File
IndexMetaData.java
Developer's decision
Concatenation
Kind of conflict
Attribute
Chunk
Conflicting content
 */
public class InternalClusterService extends AbstractLifecycleComponent implements ClusterService {

<<<<<<< HEAD
    public static final Setting CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING = Setting.positiveTimeSetting("cluster.service.slow_task_logging_threshold", TimeValue.timeValueSeconds(30), true, Setting.Scope.CLUSTER);
    public static final Setting CLUSTER_SERVICE_RECONNECT_INTERVAL_SETTING = Setting.positiveTimeSetting("cluster.service.reconnect_interval", TimeValue.timeValueSeconds(10), false, Setting.Scope.CLUSTER);
=======
    public static final Setting CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING =
        Setting.positiveTimeSetting("cluster.service.slow_task_logging_threshold", TimeValue.timeValueSeconds(30),
            Property.Dynamic, Property.NodeScope);
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca

    public static final String UPDATE_THREAD_NAME = "clusterService#updateTask";
    private final ThreadPool threadPool;
Solution content
 */
public class InternalClusterService extends AbstractLifecycleComponent implements ClusterService {

    public static final Setting CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING =
        Setting.positiveTimeSetting("cluster.service.slow_task_logging_threshold", TimeValue.timeValueSeconds(30),
            Property.Dynamic, Property.NodeScope);

    public static final String UPDATE_THREAD_NAME = "clusterService#updateTask";
    private final ThreadPool threadPool;
File
InternalClusterService.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    /**
     * Serializes a potential null value.
     */
    public  T readOptionalStreamableReader(StreamableReader streamableReader) throws IOException {
        if (readBoolean()) {
            return streamableReader.readFrom(this);
=======
    public  T readOptionalWritable(Writeable.IOFunction provider) throws IOException {
        if (readBoolean()) {
            return provider.apply(this);
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
        } else {
            return null;
        }
Solution content
        }
    }

    public  T readOptionalWritable(Writeable.IOFunction provider) throws IOException {
        if (readBoolean()) {
            return provider.apply(this);
        } else {
            return null;
        }
File
StreamInput.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method invocation
Method signature
Return statement
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    /**
     * Serializes a potential null value.
     */
    public void writeOptionalWritable(@Nullable Writeable writeable) throws IOException {
=======
    public void writeOptionalWriteable(@Nullable Writeable writeable) throws IOException {
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
        if (writeable != null) {
            writeBoolean(true);
            writeable.writeTo(this);
Solution content
        }
    }
    public void writeOptionalWriteable(@Nullable Writeable writeable) throws IOException {
        if (writeable != null) {
            writeBoolean(true);
            writeable.writeTo(this);
File
StreamOutput.java
Developer's decision
Version 2
Kind of conflict
Comment
Method signature
Chunk
Conflicting content
    }

    public void testFillShardLevelInfo() {
<<<<<<< HEAD
        final Index index = new Index("test", "_na_");
        ShardRouting test_0 = ShardRouting.newUnassigned(index, 0, null, 1, false, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
=======
        final Index index = new Index("test", "0xdeadbeef");
        ShardRouting test_0 = ShardRouting.newUnassigned(index, 0, null, false, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
        ShardRoutingHelper.initialize(test_0, "node1");
        ShardRoutingHelper.moveToStarted(test_0);
        Path test0Path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0");
Solution content
    }

    public void testFillShardLevelInfo() {
        final Index index = new Index("test", "0xdeadbeef");
        ShardRouting test_0 = ShardRouting.newUnassigned(index, 0, null, 1, false, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
        ShardRoutingHelper.initialize(test_0, "node1");
        ShardRoutingHelper.moveToStarted(test_0);
        Path test0Path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0");
File
DiskUsageTests.java
Developer's decision
Combination
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        Path test1Path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("1");
        CommonStats commonStats1 = new CommonStats();
        commonStats1.store = new StoreStats(1000, 1);
<<<<<<< HEAD
        ShardStats[] stats = new ShardStats[]{
                new ShardStats(test_0, new ShardPath(false, test0Path, test0Path, "0xdeadbeef", test_0.shardId()), commonStats0, null, null),
                new ShardStats(test_1, new ShardPath(false, test1Path, test1Path, "0xdeadbeef", test_1.shardId()), commonStats1, null, null)
=======
        ShardStats[] stats  = new ShardStats[] {
                new ShardStats(test_0, new ShardPath(false, test0Path, test0Path, test_0.shardId()), commonStats0 , null),
                new ShardStats(test_1, new ShardPath(false, test1Path, test1Path, test_1.shardId()), commonStats1 , null)
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
        };
        ImmutableOpenMap.Builder shardSizes = ImmutableOpenMap.builder();
        ImmutableOpenMap.Builder routingToPath = ImmutableOpenMap.builder();
Solution content
        Path test1Path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("1");
        CommonStats commonStats1 = new CommonStats();
        commonStats1.store = new StoreStats(1000, 1);
        ShardStats[] stats  = new ShardStats[] {
                new ShardStats(test_0, new ShardPath(false, test0Path, test0Path, test_0.shardId()), commonStats0 , null, null),
                new ShardStats(test_1, new ShardPath(false, test1Path, test1Path, test_1.shardId()), commonStats1 , null, null)
        };
        ImmutableOpenMap.Builder shardSizes = ImmutableOpenMap.builder();
        ImmutableOpenMap.Builder routingToPath = ImmutableOpenMap.builder();
File
DiskUsageTests.java
Developer's decision
Manual
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        }
        if (!shards.isEmpty()) {
            return randomSubsetOf(1, shards.toArray(new ShardRouting[0])).get(0);
        } else {
<<<<<<< HEAD
            return TestShardRouting.newShardRouting(shardRouting.index(), shardRouting.id(),
                    InternalClusterService.generateNodeId(Settings.EMPTY), randomInt(20), randomBoolean(),
                    randomFrom(ShardRoutingState.values()));
=======
            return
                    TestShardRouting.newShardRouting(shardRouting.index(), shardRouting.id(), DiscoveryNodeService.generateNodeId(Settings.EMPTY), randomBoolean(), randomFrom(ShardRoutingState.values()));
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
    }
Solution content
        if (!shards.isEmpty()) {
            return randomSubsetOf(1, shards.toArray(new ShardRouting[0])).get(0);
        } else {
            return TestShardRouting.newShardRouting(shardRouting.index(), shardRouting.id(),
                    DiscoveryNodeService.generateNodeId(Settings.EMPTY), randomInt(20), randomBoolean(),
                    randomFrom(ShardRoutingState.values()));
        }
    }
File
ShardFailedClusterStateTaskExecutorTests.java
Developer's decision
Manual
Kind of conflict
Other
Chunk
Conflicting content
        createIndex("test");
        ensureGreen();
        NodeEnvironment env = getInstanceFromNode(NodeEnvironment.class);
<<<<<<< HEAD
        Path[] shardPaths = env.availableShardPaths(new ShardId("test", "_na_", 0));
        logger.info("--> paths: [{}]", (Object) shardPaths);
=======
        ClusterService cs = getInstanceFromNode(ClusterService.class);
        final Index index = cs.state().metaData().index("test").getIndex();
        Path[] shardPaths = env.availableShardPaths(new ShardId(index, 0));
        logger.info("--> paths: [{}]", (Object)shardPaths);
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
        // Should not be able to acquire the lock because it's already open
        try {
            NodeEnvironment.acquireFSLockForPaths(IndexSettingsModule.newIndexSettings("test", Settings.EMPTY), shardPaths);
Solution content
        createIndex("test");
        ensureGreen();
        NodeEnvironment env = getInstanceFromNode(NodeEnvironment.class);

        ClusterService cs = getInstanceFromNode(ClusterService.class);
        final Index index = cs.state().metaData().index("test").getIndex();
        Path[] shardPaths = env.availableShardPaths(new ShardId(index, 0));
        logger.info("--> paths: [{}]", (Object)shardPaths);
        // Should not be able to acquire the lock because it's already open
        try {
            NodeEnvironment.acquireFSLockForPaths(IndexSettingsModule.newIndexSettings("test", Settings.EMPTY), shardPaths);
File
IndexShardTests.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
import java.util.function.Consumer;
import java.util.function.Supplier;

<<<<<<< HEAD
=======
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.common.util.CollectionUtils.arrayAsArrayList;
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
import static org.hamcrest.Matchers.equalTo;

/**
Solution content
import java.util.function.Consumer;
import java.util.function.Supplier;

import static org.elasticsearch.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.common.util.CollectionUtils.arrayAsArrayList;
import static org.hamcrest.Matchers.equalTo;

/**
File
ESTestCase.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
     * Returns size random values
     */
    public static  List randomSubsetOf(int size, T... values) {
<<<<<<< HEAD
        return randomSubsetOf(size, Arrays.asList(values));
=======
        List list = arrayAsArrayList(values);
        return randomSubsetOf(size, list);
    }

    /**
     * Returns a random subset of values (including a potential empty list)
     */
    public static  List randomSubsetOf(Collection collection) {
        return randomSubsetOf(randomInt(collection.size() - 1), collection);
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
    }

    /**
Solution content
     * Returns size random values
     */
    public static  List randomSubsetOf(int size, T... values) {
        List list = arrayAsArrayList(values);
        return randomSubsetOf(size, list);
    }

    /**
     * Returns a random subset of values (including a potential empty list)
     */
    public static  List randomSubsetOf(Collection collection) {
        return randomSubsetOf(randomInt(collection.size() - 1), collection);
    }

    /**
File
ESTestCase.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
    /**
     * Returns size random values
     */
<<<<<<< HEAD
    public static  List randomSubsetOf(int size, Collection values) {
        if (size > values.size()) {
            throw new IllegalArgumentException("Can\'t pick " + size + " random objects from a list of " + values.size() + " objects");
        }
        List list = new ArrayList<>(values);
        Collections.shuffle(list, random());
        return list.subList(0, size);
=======
    public static  List randomSubsetOf(int size, Collection collection) {
        if (size > collection.size()) {
            throw new IllegalArgumentException("Can\'t pick " + size + " random objects from a collection of " + collection.size() + " objects");
        }
        List tempList = new ArrayList<>(collection);
        Collections.shuffle(tempList, random());
        return tempList.subList(0, size);
>>>>>>> ef4293a993014379c54e2399e692c6387d80f0ca
    }

Solution content
    /**
     * Returns size random values
     */
    public static  List randomSubsetOf(int size, Collection collection) {
        if (size > collection.size()) {
            throw new IllegalArgumentException("Can\'t pick " + size + " random objects from a collection of " + collection.size() + " objects");
        }
        List tempList = new ArrayList<>(collection);
        Collections.shuffle(tempList, random());
        return tempList.subList(0, size);
    }

File
ESTestCase.java
Developer's decision
Version 2
Kind of conflict
Method signature