confluentinc / confluentinc/schema-registry

NotEnoughReplicasException

Open
#313 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.5k
Forks
1.2k
Avg merge
23h 27m
Merged PRs (30d)
65

Description

I get the below exception (after which the schema-registry exits), but the exception doesn't print out the numbers of required replicas nor the number of insync replicas. This would essentially force me to build the schema-registry from source in order to find those values; _not_ something you should require your users to go through.

In the meanwhile, I would appreciate a hint as to what's wrong.

```
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/java/confluent-common/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/schema-registry/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
[2016-04-08 14:57:19,115] INFO SchemaRegistryConfig values:
metric.reporters = []
kafkastore.connection.url = 127.0.0.1:2181
avro.compatibility.level = backward
debug = true
shutdown.graceful.ms = 1000
response.mediatype.preferred = [application/vnd.schemaregistry.v1+json, application/vnd.schemaregistry+json, application/json]
kafkastore.commit.interval.ms = -1
response.mediatype.default = application/vnd.schemaregistry.v1+json
kafkastore.topic = _schemas
metrics.jmx.prefix = kafka.schema.registry
access.control.allow.origin =
port = 8081
request.logger.name = io.confluent.rest-utils.requests
metrics.sample.window.ms = 30000
kafkastore.zk.session.timeout.ms = 30000
master.eligibility = true
kafkastore.topic.replication.factor = 1
kafkastore.timeout.ms = 500
host.name = kafka-dev
schema.registry.zk.namespace = schema_registry
kafkastore.init.timeout.ms = 60000
metrics.num.samples = 2
(io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig:135)
[2016-04-08 14:57:19,599] INFO Initialized the consumer offset to -1 (io.confluent.kafka.schemaregistry.storage.KafkaStoreReaderThread:86)
[2016-04-08 14:57:20,034] INFO [kafka-store-reader-thread-_schemas], Starting (io.confluent.kafka.schemaregistry.storage.KafkaStoreReaderThread:68)
[2016-04-08 14:57:20,156] ERROR Error starting the schema registry (io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication:57)
io.confluent.kafka.schemaregistry.exceptions.SchemaRegistryInitializationException: Error initializing kafka store while initializing schema registry
at io.confluent.kafka.schemaregistry.storage.KafkaSchemaRegistry.init(KafkaSchemaRegistry.java:166)
at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:55)
at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:37)
at io.confluent.rest.Application.createServer(Application.java:109)
at io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain.main(SchemaRegistryMain.java:43)
Caused by: io.confluent.kafka.schemaregistry.storage.exceptions.StoreInitializationException: io.confluent.kafka.schemaregistry.storage.exceptions.StoreException: Failed to write Noop record to kafka store.
at io.confluent.kafka.schemaregistry.storage.KafkaStore.init(KafkaStore.java:155)
at io.confluent.kafka.schemaregistry.storage.KafkaSchemaRegistry.init(KafkaSchemaRegistry.java:164)
... 4 more
Caused by: io.confluent.kafka.schemaregistry.storage.exceptions.StoreException: Failed to write Noop record to kafka store.
at io.confluent.kafka.schemaregistry.storage.KafkaStore.getLatestOffset(KafkaStore.java:367)
at io.confluent.kafka.schemaregistry.storage.KafkaStore.waitUntilKafkaReaderReachesLastOffset(KafkaStore.java:224)
at io.confluent.kafka.schemaregistry.storage.KafkaStore.init(KafkaStore.java:153)
... 5 more
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.NotEnoughReplicasException: Messages are rejected since there are fewer in-sync replicas than required.
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.valueOrError(FutureRecordMetadata.java:56)
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:51)
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:25)
at io.confluent.kafka.schemaregistry.storage.KafkaStore.getLatestOffset(KafkaStore.java:363)
... 7 more
Caused by: org.apache.kafka.common.errors.NotEnoughReplicasException: Messages are rejected since there are fewer in-sync replicas than required.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the failure path in storage/KafkaStore.java, especially getLatestOffset and init, then inspect how NotEnoughReplicasException is surfaced through SchemaRegistryInitializationException. Reproduce the shown schema-registry startup failure and verify that the resulting error reports the required and in-sync replica counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.