-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] <title>NPE when SETTING_NUMBER_OF_REPLICAS is null #14783
Comments
The default value of replica count is not always 1, user can configure the default value through this cluster setting I think it's better to treat |
Fixed in #14812 |
[Indexing Triage Meeting 07/22] @chishui Thanks for working on this. I've assigned the issue to you. Please let us know if you are planning to continue working on it, and targeting to merge it within a release window. |
Complimenting my comment on #14810, if we have an agreement that |
Describe the bug
in OS 2.15, IndexSetting.java, method getNumberOfReplicas will give null pointer exception in scenarios when null is returned from settings.getAsInt methods because the return type of this method is int (not Integer).
public int getNumberOfReplicas() {
return settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, null);
}
Related component
Indexing
To Reproduce
Create an index with replica count passed as null.
Expected behavior
It should treat the default value as 1 for replica count is not passed.
Additional Details
[2024-07-16T17:02:27,740][DEBUG][o.o.c.m.MetadataCreateIndexService] [local_10-10] [ds7_dfs_] failed to create
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.opensearch.common.settings.Settings.getAsInt(String, java.lang.Integer)" is null
at org.opensearch.index.IndexSettings.getNumberOfReplicas(IndexSettings.java:1248)
at org.opensearch.indices.IndicesService.createIndexService(IndicesService.java:867)
at org.opensearch.indices.IndicesService.withTempIndexService(IndicesService.java:830)
at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexWithTemporaryService(MetadataCreateIndexService.java:502)
at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequestWithV1Templates(MetadataCreateIndexService.java:643)
at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequest(MetadataCreateIndexService.java:464) ~
at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequest(MetadataCreateIndexService.java:471)
at org.opensearch.cluster.metadata.MetadataCreateIndexService$1.execute(MetadataCreateIndexService.java:377)
at org.opensearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:67)
at org.opensearch.cluster.service.MasterService.executeTasks(MasterService.java:904)
at org.opensearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:456)
at org.opensearch.cluster.service.MasterService.runTasks(MasterService.java:316)
at org.opensearch.cluster.service.MasterService$Batcher.run(MasterService.java:227)
at org.opensearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:204)
at org.opensearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:242)
at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:882)
at org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedOpenSearchThreadPoolExecutor.java:283)
The text was updated successfully, but these errors were encountered: