Package org.elasticsearch.index.shard

Examples of org.elasticsearch.index.shard.ShardId


        while (nodesIterator.hasNext()) {
            JsonNode fstStatsNodeEntry =  nodesIterator.next();

            if (fstStatsNodeEntry.isObject()) {
                ShardId shardId = new ShardId(fstStatsNodeEntry.get("index").asText(), fstStatsNodeEntry.get("id").asInt());
                FstStats.FstIndexShardStats fstIndexShardStats = new FstStats.FstIndexShardStats(shardId, null, null, fstStatsNodeEntry.get("sizeInBytes").getLongValue());
                stats.add(fstIndexShardStats);
            }

            fstStats.getStats().addAll(stats);
View Full Code Here


                any(ClusterState.class),
                anyString(),
                anyString(),
                Matchers.eq(shardId.toString()),
                anyString())).thenReturn(shardIterator);
        when(shardIterator.shardId()).thenReturn(new ShardId("foo", shardId));
    }
View Full Code Here

        private final ShardId shardId;
        private final ShardIdExpression shardIdExpression;

        public TestShardModule(int shardId) {
            super();
            this.shardId = new ShardId(TEST_TABLE_NAME, shardId);
            this.shardIdExpression = new ShardIdExpression(this.shardId);
        }
View Full Code Here

        private final ShardId shardId;
        private final ShardIdExpression shardIdExpression;

        public TestShardModule(int shardId) {
            super();
            this.shardId = new ShardId(TEST_TABLE_NAME, shardId);
            this.shardIdExpression = new ShardIdExpression(this.shardId);
        }
View Full Code Here

                new UnassignedShardsCollectService(null, null, null).new UnassignedShardIteratorContext();
        // Set<ShardId> must be instantiated but empty,
        // which means: no primary shards available; all shards unassigned for a specific table name and shard id
        context.seenPrimaries = new HashSet<>();

        assertTrue(context.isPrimary(new ShardId("index", 1)));
        assertEquals(1, context.seenPrimaries.size());
        assertFalse(context.isPrimary(new ShardId("index", 1)));
    }
View Full Code Here

        ESCountTask.CountResponseListener listener = new ESCountTask.CountResponseListener(result);


        ShardOperationFailedException[] shardFailures = new ShardOperationFailedException[] {
                new DefaultShardOperationFailedException("dummy", 2,
                        new IndexShardException(new ShardId("dummy", 2), "dummy message"))
        };
        CountResponse countResponse = mock(CountResponse.class);
        when(countResponse.getFailedShards()).thenReturn(1);
        when(countResponse.getShardFailures()).thenReturn(shardFailures);
View Full Code Here

                .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
                .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2)
                .build();
        blobIndices.createBlobTable("test", indexSettings).get();
        ensureGreen();
        assertTrue(blobEnvironment.shardLocation(new ShardId(".blob_test", 0)).exists()
         || blobEnvironment.shardLocation(new ShardId(".blob_test", 1)).exists());
        assertTrue(blobEnvironment2.shardLocation(new ShardId(".blob_test", 0)).exists()
                || blobEnvironment2.shardLocation(new ShardId(".blob_test", 1)).exists());

        blobIndices.dropBlobTable("test").get();
        assertFalse(blobEnvironment.indexLocation(new Index(".blob_test")).exists());
        assertFalse(blobEnvironment2.indexLocation(new Index(".blob_test")).exists());
    }
View Full Code Here

                .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2)
                .put(BlobIndices.SETTING_INDEX_BLOBS_PATH, tempBlobPath.getAbsolutePath())
                .build();
        blobIndices.createBlobTable("test", indexSettings).get();
        ensureGreen();
        assertTrue(blobEnvironment.shardLocation(new ShardId(".blob_test", 0), tempBlobPath).exists()
                || blobEnvironment.shardLocation(new ShardId(".blob_test", 1), tempBlobPath).exists());
        assertTrue(blobEnvironment2.shardLocation(new ShardId(".blob_test", 0), tempBlobPath).exists()
                || blobEnvironment2.shardLocation(new ShardId(".blob_test", 1), tempBlobPath).exists());

        blobIndices.createBlobTable("test2", indexSettings).get();
        ensureGreen();
        assertTrue(blobEnvironment.shardLocation(new ShardId(".blob_test2", 0), tempBlobPath).exists()
                || blobEnvironment.shardLocation(new ShardId(".blob_test2", 1), tempBlobPath).exists());
        assertTrue(blobEnvironment2.shardLocation(new ShardId(".blob_test2", 0), tempBlobPath).exists()
                || blobEnvironment2.shardLocation(new ShardId(".blob_test2", 1), tempBlobPath).exists());

        blobIndices.dropBlobTable("test").get();
        assertFalse(blobEnvironment.indexLocation(new Index(".blob_test"), tempBlobPath).exists());
        assertFalse(blobEnvironment2.indexLocation(new Index(".blob_test"), tempBlobPath).exists());
View Full Code Here

    }

    @Test
    public void testShardLocation() throws Exception {
        File blobsPath = new File("/tmp/crate_blobs");
        File shardLocation = blobEnvironment.shardLocation(new ShardId(".blob_test", 0), blobsPath);
        assertThat(shardLocation.getAbsolutePath().substring(0, blobsPath.getAbsolutePath().length()),
                is(blobsPath.getAbsolutePath()));
    }
View Full Code Here

                is(blobsPath.getAbsolutePath()));
    }

    @Test
    public void testShardLocationWithoutCustomPath() throws Exception {
        File shardLocation = blobEnvironment.shardLocation(new ShardId(".blob_test", 0));
        File nodeShardLocation = nodeEnvironment.shardLocations(new ShardId(".blob_test", 0))[0];
        assertThat(shardLocation.getAbsolutePath().substring(nodeShardLocation.getAbsolutePath().length()),
                is("/"+BlobEnvironment.BLOBS_SUB_PATH));
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.shard.ShardId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.