{"action":"created","comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/22602961","id":22602961,"diff_hunk":"@@ -163,58 +158,58 @@\n \n     private final IndexThrottle throttle;\n \n-    public InternalEngine(ShardId shardId, ESLogger logger, CodecService codecService, ThreadPool threadPool,\n-                          ShardIndexingService indexingService, @Nullable IndicesWarmer warmer,\n-                          Store store, SnapshotDeletionPolicy deletionPolicy, Translog translog,\n-                          MergePolicyProvider mergePolicyProvider, MergeSchedulerProvider mergeScheduler,\n-                          AnalysisService analysisService, SimilarityService similarityService,\n-                          boolean enableGcDeletes, long gcDeletesInMillis, ByteSizeValue indexingBufferSize, String codecName,\n-                          boolean compoundOnFlush, int indexConcurrency, boolean optimizeAutoGenerateId, boolean failEngineOnCorruption,\n-                          FailedEngineListener failedEngineListener) throws EngineException {\n-        Preconditions.checkNotNull(store, \"Store must be provided to the engine\");\n-        Preconditions.checkNotNull(deletionPolicy, \"Snapshot deletion policy must be provided to the engine\");\n-        Preconditions.checkNotNull(translog, \"Translog must be provided to the engine\");\n-\n-        this.shardId = shardId;\n-        this.logger = logger;\n-        this.gcDeletesInMillis = gcDeletesInMillis;\n-        this.enableGcDeletes = enableGcDeletes;\n-        this.indexingBufferSize = indexingBufferSize;\n-        this.codecName = codecName;\n-\n-        this.threadPool = threadPool;\n+    public InternalEngine(EngineConfig config) throws EngineException {\n+        Preconditions.checkNotNull(config.getStore(), \"Store must be provided to the engine\");\n+        Preconditions.checkNotNull(config.getDeletionPolicy(), \"Snapshot deletion policy must be provided to the engine\");\n+        Preconditions.checkNotNull(config.getTranslog(), \"Translog must be provided to the engine\");\n+\n+        this.shardId = config.getShardId();\n+        this.logger = Loggers.getLogger(getClass(), config.getIndexSettings(), shardId);\n+        this.threadPool = config.getThreadPool();\n         this.lastDeleteVersionPruneTimeMSec = threadPool.estimatedTimeInMillis();\n-        this.indexingService = indexingService;\n-        this.warmer = (InternalIndicesWarmer) warmer;\n-        this.store = store;\n-        this.deletionPolicy = deletionPolicy;\n-        this.translog = translog;\n-        this.mergePolicyProvider = mergePolicyProvider;\n-        this.mergeScheduler = mergeScheduler;\n-        this.analysisService = analysisService;\n-        this.similarityService = similarityService;\n-        this.codecService = codecService;\n-        this.compoundOnFlush = compoundOnFlush;\n-        this.indexConcurrency = indexConcurrency;\n+        this.indexingService = config.getIndexingService();\n+        this.warmer = config.getWarmer();\n+        this.store = config.getStore();\n+        this.deletionPolicy = config.getDeletionPolicy();\n+        this.translog = config.getTranslog();\n+        this.mergePolicyProvider = config.getMergePolicyProvider();\n+        this.mergeScheduler = config.getMergeScheduler();\n+        this.analysisService = config.getAnalysisService();\n+        this.similarityService = config.getSimilarityService();\n+        this.codecService = config.getCodecService();\n         this.versionMap = new LiveVersionMap();\n-        this.dirtyLocks = new Object[indexConcurrency * 50]; // we multiply it to have enough...\n+        this.dirtyLocks = new Object[config.getIndexConcurrency() * 50]; // we multiply it to have enough...\n         for (int i = 0; i < dirtyLocks.length; i++) {\n             dirtyLocks[i] = new Object();\n         }\n-        this.optimizeAutoGenerateId = optimizeAutoGenerateId;\n-        this.failEngineOnCorruption = failEngineOnCorruption;\n-        this.failedEngineListener = failedEngineListener;\n+\n+        this.mergeSchedulerFailureListener = new FailEngineOnMergeFailure();\n+        this.mergeSchedulerListener = new MergeScheduleListener();\n+        this.mergeScheduler.addListener(mergeSchedulerListener);\n+        this.mergeScheduler.addFailureListener(mergeSchedulerFailureListener);\n+\n+        this.failedEngineListener = config.getFailedEngineListener();\n         throttle = new IndexThrottle();\n+        this.config = config;\n+        listener = new EngineConfig.ApplySettings(logger, config) {","path":"src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java","position":106,"original_position":106,"commit_id":"854454bc25db75fa514592218b314b90b5045784","original_commit_id":"854454bc25db75fa514592218b314b90b5045784","user":{"login":"dakrone","id":19060,"avatar_url":"https://avatars.githubusercontent.com/u/19060?v=3","gravatar_id":"","url":"https://api.github.com/users/dakrone","html_url":"https://github.com/dakrone","followers_url":"https://api.github.com/users/dakrone/followers","following_url":"https://api.github.com/users/dakrone/following{/other_user}","gists_url":"https://api.github.com/users/dakrone/gists{/gist_id}","starred_url":"https://api.github.com/users/dakrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakrone/subscriptions","organizations_url":"https://api.github.com/users/dakrone/orgs","repos_url":"https://api.github.com/users/dakrone/repos","events_url":"https://api.github.com/users/dakrone/events{/privacy}","received_events_url":"https://api.github.com/users/dakrone/received_events","type":"User","site_admin":false},"body":"Not sure if this should be a concrete inner class also, to avoid the GC issue you mentioned to me before?","created_at":"2015-01-07T18:06:33Z","updated_at":"2015-01-07T18:06:33Z","html_url":"https://github.com/elasticsearch/elasticsearch/pull/9181#discussion_r22602961","pull_request_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181","_links":{"self":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/22602961"},"html":{"href":"https://github.com/elasticsearch/elasticsearch/pull/9181#discussion_r22602961"},"pull_request":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181"}}},"pull_request":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181","id":26972731,"html_url":"https://github.com/elasticsearch/elasticsearch/pull/9181","diff_url":"https://github.com/elasticsearch/elasticsearch/pull/9181.diff","patch_url":"https://github.com/elasticsearch/elasticsearch/pull/9181.patch","issue_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/9181","number":9181,"state":"open","locked":false,"title":"[CORE] Fold engine into IndexShard","user":{"login":"s1monw","id":973334,"avatar_url":"https://avatars.githubusercontent.com/u/973334?v=3","gravatar_id":"","url":"https://api.github.com/users/s1monw","html_url":"https://github.com/s1monw","followers_url":"https://api.github.com/users/s1monw/followers","following_url":"https://api.github.com/users/s1monw/following{/other_user}","gists_url":"https://api.github.com/users/s1monw/gists{/gist_id}","starred_url":"https://api.github.com/users/s1monw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1monw/subscriptions","organizations_url":"https://api.github.com/users/s1monw/orgs","repos_url":"https://api.github.com/users/s1monw/repos","events_url":"https://api.github.com/users/s1monw/events{/privacy}","received_events_url":"https://api.github.com/users/s1monw/received_events","type":"User","site_admin":false},"body":"This commit removes most of the Engine abstractions and removes\r\nEngine exposure via dependency injection. It also removes the Holder\r\nabstraction and makes the engine itself start at constrcution time.\r\nIt removes the start method from the engine entire which means no engine\r\ninstances exists until it's started. There is also no way to stop the\r\nengine to restart, it needs to be an entire new Engine","created_at":"2015-01-07T17:27:23Z","updated_at":"2015-01-07T18:06:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f9161903295c29b2fe9749ab9277ffd5294cef5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181/commits","review_comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181/comments","review_comment_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/{number}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/9181/comments","statuses_url":"https://api.github.com/repos/elasticsearch/elasticsearch/statuses/854454bc25db75fa514592218b314b90b5045784","head":{"label":"s1monw:merge_engine","ref":"merge_engine","sha":"854454bc25db75fa514592218b314b90b5045784","user":{"login":"s1monw","id":973334,"avatar_url":"https://avatars.githubusercontent.com/u/973334?v=3","gravatar_id":"","url":"https://api.github.com/users/s1monw","html_url":"https://github.com/s1monw","followers_url":"https://api.github.com/users/s1monw/followers","following_url":"https://api.github.com/users/s1monw/following{/other_user}","gists_url":"https://api.github.com/users/s1monw/gists{/gist_id}","starred_url":"https://api.github.com/users/s1monw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1monw/subscriptions","organizations_url":"https://api.github.com/users/s1monw/orgs","repos_url":"https://api.github.com/users/s1monw/repos","events_url":"https://api.github.com/users/s1monw/events{/privacy}","received_events_url":"https://api.github.com/users/s1monw/received_events","type":"User","site_admin":false},"repo":{"id":4663744,"name":"elasticsearch","full_name":"s1monw/elasticsearch","owner":{"login":"s1monw","id":973334,"avatar_url":"https://avatars.githubusercontent.com/u/973334?v=3","gravatar_id":"","url":"https://api.github.com/users/s1monw","html_url":"https://github.com/s1monw","followers_url":"https://api.github.com/users/s1monw/followers","following_url":"https://api.github.com/users/s1monw/following{/other_user}","gists_url":"https://api.github.com/users/s1monw/gists{/gist_id}","starred_url":"https://api.github.com/users/s1monw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1monw/subscriptions","organizations_url":"https://api.github.com/users/s1monw/orgs","repos_url":"https://api.github.com/users/s1monw/repos","events_url":"https://api.github.com/users/s1monw/events{/privacy}","received_events_url":"https://api.github.com/users/s1monw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/s1monw/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/s1monw/elasticsearch","forks_url":"https://api.github.com/repos/s1monw/elasticsearch/forks","keys_url":"https://api.github.com/repos/s1monw/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s1monw/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s1monw/elasticsearch/teams","hooks_url":"https://api.github.com/repos/s1monw/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/s1monw/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/s1monw/elasticsearch/events","assignees_url":"https://api.github.com/repos/s1monw/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/s1monw/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/s1monw/elasticsearch/tags","blobs_url":"https://api.github.com/repos/s1monw/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s1monw/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s1monw/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/s1monw/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s1monw/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/s1monw/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/s1monw/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/s1monw/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/s1monw/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/s1monw/elasticsearch/subscription","commits_url":"https://api.github.com/repos/s1monw/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/s1monw/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/s1monw/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/s1monw/elasticsearch/issues/comments/{number}","contents_url":"https://api.github.com/repos/s1monw/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/s1monw/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s1monw/elasticsearch/merges","archive_url":"https://api.github.com/repos/s1monw/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s1monw/elasticsearch/downloads","issues_url":"https://api.github.com/repos/s1monw/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/s1monw/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/s1monw/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/s1monw/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s1monw/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/s1monw/elasticsearch/releases{/id}","created_at":"2012-06-14T13:44:13Z","updated_at":"2015-01-07T15:33:07Z","pushed_at":"2015-01-07T17:26:36Z","git_url":"git://github.com/s1monw/elasticsearch.git","ssh_url":"git@github.com:s1monw/elasticsearch.git","clone_url":"https://github.com/s1monw/elasticsearch.git","svn_url":"https://github.com/s1monw/elasticsearch","homepage":"http://elasticsearch.org","size":82858,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"elasticsearch:master","ref":"master","sha":"77493762e2bf503e163cbff5d9a1f1223bb77da4","user":{"login":"elasticsearch","id":141304,"avatar_url":"https://avatars.githubusercontent.com/u/141304?v=3","gravatar_id":"","url":"https://api.github.com/users/elasticsearch","html_url":"https://github.com/elasticsearch","followers_url":"https://api.github.com/users/elasticsearch/followers","following_url":"https://api.github.com/users/elasticsearch/following{/other_user}","gists_url":"https://api.github.com/users/elasticsearch/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticsearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticsearch/subscriptions","organizations_url":"https://api.github.com/users/elasticsearch/orgs","repos_url":"https://api.github.com/users/elasticsearch/repos","events_url":"https://api.github.com/users/elasticsearch/events{/privacy}","received_events_url":"https://api.github.com/users/elasticsearch/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elasticsearch/elasticsearch","owner":{"login":"elasticsearch","id":141304,"avatar_url":"https://avatars.githubusercontent.com/u/141304?v=3","gravatar_id":"","url":"https://api.github.com/users/elasticsearch","html_url":"https://github.com/elasticsearch","followers_url":"https://api.github.com/users/elasticsearch/followers","following_url":"https://api.github.com/users/elasticsearch/following{/other_user}","gists_url":"https://api.github.com/users/elasticsearch/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticsearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticsearch/subscriptions","organizations_url":"https://api.github.com/users/elasticsearch/orgs","repos_url":"https://api.github.com/users/elasticsearch/repos","events_url":"https://api.github.com/users/elasticsearch/events{/privacy}","received_events_url":"https://api.github.com/users/elasticsearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elasticsearch/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elasticsearch/elasticsearch","forks_url":"https://api.github.com/repos/elasticsearch/elasticsearch/forks","keys_url":"https://api.github.com/repos/elasticsearch/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elasticsearch/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elasticsearch/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elasticsearch/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch/events","assignees_url":"https://api.github.com/repos/elasticsearch/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elasticsearch/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elasticsearch/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elasticsearch/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elasticsearch/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elasticsearch/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elasticsearch/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elasticsearch/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elasticsearch/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elasticsearch/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elasticsearch/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elasticsearch/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elasticsearch/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elasticsearch/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elasticsearch/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/comments/{number}","contents_url":"https://api.github.com/repos/elasticsearch/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elasticsearch/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elasticsearch/elasticsearch/merges","archive_url":"https://api.github.com/repos/elasticsearch/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elasticsearch/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elasticsearch/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elasticsearch/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elasticsearch/elasticsearch/releases{/id}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-01-07T16:13:19Z","pushed_at":"2015-01-07T15:38:49Z","git_url":"git://github.com/elasticsearch/elasticsearch.git","ssh_url":"git@github.com:elasticsearch/elasticsearch.git","clone_url":"https://github.com/elasticsearch/elasticsearch.git","svn_url":"https://github.com/elasticsearch/elasticsearch","homepage":"http://elasticsearch.org","size":257226,"stargazers_count":9491,"watchers_count":9491,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2906,"mirror_url":null,"open_issues_count":854,"forks":2906,"open_issues":854,"watchers":9491,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181"},"html":{"href":"https://github.com/elasticsearch/elasticsearch/pull/9181"},"issue":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/9181"},"comments":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/9181/comments"},"review_comments":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181/comments"},"review_comment":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/9181/commits"},"statuses":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/statuses/854454bc25db75fa514592218b314b90b5045784"}}}}