问题
Is there any way to stop the build of a materialized view in Cassandra (3.7)?
Background: I created two materialized views A and B (full disclosure - I may have attempted to drop them before the build was complete) and those views seem to be perpetually stuck...any attempt to create another view C on the same table seems to hang. Using nodetool
nodetool.viewbuildstatus <keyspace>.<view>
shows a combination of STARTED and UNKNOWN for A and B, and STARTED for views in C. Using cql:
select * from system.views_builds_in_progress
all views are listed, but generation number and last_token have not changed in the last 24hrs (generation_number is in fact null for A).
回答1:
Its not documented, but nodetool stop actually takes any compaction type, not just the ones listed (which the view build is one of). So you can simply:
nodetool stop VIEW_BUILD
Or you can hit JMX directly with the org.apache.cassandra.db:type=CompactionManager mbean's stopCompaction operation.
All thats really gonna do is set a flag for the view builder to stop on its next loop. If it threw an uncaught exception or something so its no longer doing anything (worth checking system/output logs) the stop wont do anything either. In that case its not really hurting anything though so can ignore it and retry. Worst case restart the node.
来源:https://stackoverflow.com/questions/40553499/stop-cassandra-materialized-view-build