Probably want to do something like SystemKeyspace.bootstrapComplete() On Thu, Jan 5, 2017 at 1:58 PM, Eric Stevens <migh...@gmail.com> wrote:
> I'm working on a bug report in my Deleting Compaction Strategy project. > > Some of the provided deletion strategies allow for a series of deletion > rules to be added to a CQL table, before compaction begins, a snapshot of > the current rules are read out of the CQL table and a deletion plan is > produced that applies for the life of that compaction. > > The bug report (at https://github.com/protectwise/cassandra-util/issues/2) > is that if compaction begins while a node is first starting up, before it > has joined the ring, the attempt to read the rules will fail with an > AssertionError (it's an attempt to call QueryProcessor.process at local > quorum before the node has joined the ring). > > My question is, how can I detect when a node has fully joined the ring, and > it's safe to call QueryProcessor.process without just trying, failing, and > catching (and even then how would I know that it's because the node is > still starting up vs some other source of problems)? I had thought that > something might set a flag during the startup process to indicate that the > node thinks it is fully started up, but as far as I see nothing like that > is tracked. > > I took a stab at what this could look like here: > https://github.com/protectwise/cassandra-util/blob/ > 93dfb02157446e2e37427f1d4846c6039cc97099/deleting- > compaction-strategy/src/main/java/com/protectwise/ > cassandra/retrospect/deletion/QueryHelper.java#L31-L36 > > This approach seems cumbersome and fragile, and I feel like I'm missing > something. How else could I tell whether it's safe to call out to > QueryProcessor.process yet? > > Thanks in advance, > -e >