{"record":{"id":"e2166e50a0ffe70a","repo":"apache/cassandra","slug":"failed-to-get-schema-to-converge-before-building-v","errorCode":null,"errorMessage":"Failed to get schema to converge before building view {}.{}","messagePattern":"Failed to get schema to converge before building view (.+?)\\.(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/view/ViewBuilderTask.java","lineNumber":138,"sourceCode":"    }\n\n    public Long call()\n    {\n        String ksName = baseCfs.metadata.keyspace;\n\n        if (prevToken == null)\n            logger.debug(\"Starting new view build for range {}\", range);\n        else\n            logger.debug(\"Resuming view build for range {} from token {} with {} covered keys\", range, prevToken, keysBuilt);\n\n        /*\n         * It's possible for view building to start before MV creation got propagated to other nodes. For this reason\n         * we should wait for schema to converge before attempting to send any view mutations to other nodes, or else\n         * face UnknownTableException upon Mutation deserialization on the nodes that haven't processed the schema change.\n         */\n        boolean schemaConverged = Gossiper.instance.waitForSchemaAgreement(10, TimeUnit.SECONDS, () -> this.isStopped);\n        if (!schemaConverged)\n            logger.warn(\"Failed to get schema to converge before building view {}.{}\", baseCfs.getKeyspaceName(), view.name);\n\n        Function<org.apache.cassandra.db.lifecycle.View, Iterable<SSTableReader>> function;\n        function = org.apache.cassandra.db.lifecycle.View.select(SSTableSet.CANONICAL, s -> range.intersects(s.getBounds()));\n\n        try (ColumnFamilyStore.RefViewFragment viewFragment = baseCfs.selectAndReference(function);\n             Refs<SSTableReader> sstables = viewFragment.refs;\n             ReducingKeyIterator keyIter = new ReducingKeyIterator(sstables))\n        {\n            PeekingIterator<DecoratedKey> iter = Iterators.peekingIterator(keyIter);\n            while (!isStopped && iter.hasNext())\n            {\n                DecoratedKey key = iter.next();\n                Token token = key.getToken();\n                //skip tokens already built or not present in range\n                if (range.contains(token) && (prevToken == null || token.compareTo(prevToken) > 0))\n                {\n                    buildKey(key);\n                    ++keysBuilt;","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/view/ViewBuilderTask.java#L120-L156","documentation":"ViewBuilderTask.call() waits for schema agreement (up to 10 seconds) before building a view, because view building may start before the MV creation has propagated to every node — building too early would cause UnknownTableException when replicas deserialize view mutations. If agreement is not reached in time it logs this warning and proceeds anyway, which usually still works but risks failures on nodes lacking the schema.","triggerScenarios":"Gossiper.waitForSchemaAgreement(10, SECONDS, isStopped-check) returns false because at least one node has not applied the recent schema change within 10 seconds.","commonSituations":"CREATE MATERIALIZED VIEW executed while a node is down or gossips slowly; large schema backlogs; nodes restarting during the view creation; clock/gossip issues delaying schema push/pull.","solutions":["Confirm all nodes have converged schema (nodetool describecluster / schematokens) and let the build proceed or restart it","Fix any down or lagging nodes so schema agreement completes; then rebuild the view if mutations failed","Increase tolerance by retrying the view build after convergence rather than during churn","Check for schema version disagreements caused by failed schema migrations and repair system_schema on the outlier"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before triggering view build, confirm schema agreement:\n// nodetool describecluster  (all nodes same schema version)\n// nodetool status -> no down nodes","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create MVs during stable cluster state (no restarts in flight)","Fix down nodes before schema changes","Check gossip/schema propagation health before DDL","If the warning appears, verify schema converged and rebuild if mutations failed"],"tags":["materialized-view","schema","gossip","consistency"],"backgroundTag":"schema-agreement-timeout","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}