use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project elasticsearch by elastic.
the class AbstractSimpleTransportTestCase method testHandshakeUpdatesVersion.
public void testHandshakeUpdatesVersion() throws IOException {
assumeTrue("only tcp transport has a handshake method", serviceA.getOriginalTransport() instanceof TcpTransport);
NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList());
Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
try (MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Settings.EMPTY, Collections.emptyList()), version)) {
transport.transportServiceAdapter(serviceA.new Adapter());
transport.start();
DiscoveryNode node = new DiscoveryNode("TS_TPC", "TS_TPC", transport.boundAddress().publishAddress(), emptyMap(), emptySet(), Version.fromString("2.0.0"));
ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
builder.addConnections(1, TransportRequestOptions.Type.BULK, TransportRequestOptions.Type.PING, TransportRequestOptions.Type.RECOVERY, TransportRequestOptions.Type.REG, TransportRequestOptions.Type.STATE);
try (Transport.Connection connection = serviceA.openConnection(node, builder.build())) {
assertEquals(connection.getVersion(), version);
}
}
}
use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.
the class ProjectingRowConsumerTest method prepare.
@Before
public void prepare() {
nodeCtx = createNodeContext();
memoryManager = new OnHeapMemoryManager(usedBytes -> {
});
projectorFactory = new ProjectionToProjectorVisitor(clusterService, new NodeLimits(new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)), new NoneCircuitBreakerService(), nodeCtx, THREAD_POOL, Settings.EMPTY, mock(TransportActionProvider.class, Answers.RETURNS_DEEP_STUBS), new InputFactory(nodeCtx), new EvaluatingNormalizer(nodeCtx, RowGranularity.SHARD, r -> Literal.ofUnchecked(r.valueType(), r.valueType().implicitCast("1")), null), t -> null, t -> null, Version.CURRENT, new ShardId("dummy", UUID.randomUUID().toString(), 0), Map.of(LocalFsFileOutputFactory.NAME, new LocalFsFileOutputFactory()));
}
use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.
the class MockTransportService method createNewService.
public static MockTransportService createNewService(Settings settings, Version version, ThreadPool threadPool, @Nullable ClusterSettings clusterSettings) {
var allSettings = Settings.builder().put(TransportSettings.PORT.getKey(), ESTestCase.getPortRange()).put(settings).build();
var namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables());
var transport = new Netty4Transport(allSettings, version, threadPool, new NetworkService(List.of()), new PageCacheRecycler(allSettings), namedWriteableRegistry, new NoneCircuitBreakerService(), new NettyBootstrap(), new AlwaysOKAuthentication(name -> User.CRATE_USER), new SslContextProvider(allSettings));
return new MockTransportService(allSettings, transport, threadPool, boundAddress -> new DiscoveryNode(Node.NODE_NAME_SETTING.get(settings), UUIDs.randomBase64UUID(), boundAddress.publishAddress(), Node.NODE_ATTRIBUTES.getAsMap(settings), DiscoveryNode.getRolesFromSettings(settings), version), clusterSettings);
}
use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.
the class InternalEngineTests method testRecoverFromForeignTranslog.
@Test
public void testRecoverFromForeignTranslog() throws IOException {
final int numDocs = randomIntBetween(1, 10);
for (int i = 0; i < numDocs; i++) {
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), new BytesArray("{}"), null);
Engine.Index firstIndexRequest = new Engine.Index(newUid(doc), doc, UNASSIGNED_SEQ_NO, 0, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime(), -1, false, UNASSIGNED_SEQ_NO, 0);
Engine.IndexResult index = engine.index(firstIndexRequest);
assertThat(index.getVersion(), equalTo(1L));
}
assertVisibleCount(engine, numDocs);
Translog.TranslogGeneration generation = engine.getTranslog().getGeneration();
engine.close();
final Path badTranslogLog = createTempDir();
final String badUUID = Translog.createEmptyTranslog(badTranslogLog, SequenceNumbers.NO_OPS_PERFORMED, shardId, primaryTerm.get());
Translog translog = new Translog(new TranslogConfig(shardId, badTranslogLog, INDEX_SETTINGS, BigArrays.NON_RECYCLING_INSTANCE), badUUID, createTranslogDeletionPolicy(INDEX_SETTINGS), () -> SequenceNumbers.NO_OPS_PERFORMED, primaryTerm::get, seqNo -> {
});
translog.add(new Translog.Index("SomeBogusId", 0, primaryTerm.get(), "{}".getBytes(Charset.forName("UTF-8"))));
assertEquals(generation.translogFileGeneration, translog.currentFileGeneration());
translog.close();
EngineConfig config = engine.config();
/* create a TranslogConfig that has been created with a different UUID */
TranslogConfig translogConfig = new TranslogConfig(shardId, translog.location(), config.getIndexSettings(), BigArrays.NON_RECYCLING_INSTANCE);
EngineConfig brokenConfig = new EngineConfig(shardId, allocationId.getId(), threadPool, config.getIndexSettings(), store, newMergePolicy(), config.getAnalyzer(), new CodecService(null, logger), config.getEventListener(), IndexSearcher.getDefaultQueryCache(), IndexSearcher.getDefaultQueryCachingPolicy(), translogConfig, TimeValue.timeValueMinutes(5), config.getExternalRefreshListener(), config.getInternalRefreshListener(), new NoneCircuitBreakerService(), () -> UNASSIGNED_SEQ_NO, () -> RetentionLeases.EMPTY, primaryTerm::get, tombstoneDocSupplier());
expectThrows(EngineCreationFailureException.class, () -> new InternalEngine(brokenConfig));
// and recover again!
engine = createEngine(store, primaryTranslogDir);
assertVisibleCount(engine, numDocs, true);
}
use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.
the class TcpTransportTest method testDefaultSeedAddresses.
private void testDefaultSeedAddresses(final Settings settings, Matcher<Iterable<? extends String>> seedAddressesMatcher) {
final TestThreadPool testThreadPool = new TestThreadPool("test");
try {
final TcpTransport tcpTransport = new TcpTransport(settings, Version.CURRENT, testThreadPool, new PageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService(), writableRegistry(), new NetworkService(Collections.emptyList())) {
@Override
protected TcpServerChannel bind(String name, InetSocketAddress address) {
throw new UnsupportedOperationException();
}
@Override
protected TcpChannel initiateChannel(DiscoveryNode node) {
throw new UnsupportedOperationException();
}
@Override
protected void stopInternal() {
throw new UnsupportedOperationException();
}
};
assertThat(tcpTransport.getDefaultSeedAddresses(), seedAddressesMatcher);
} finally {
testThreadPool.shutdown();
}
}
Aggregations