cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-12461) Add hooks to StorageService shutdown
Date Thu, 22 Sep 2016 11:27:20 GMT


Alex Petrov commented on CASSANDRA-12461:

I've discovered several more problems while working on this patch:

  * node drain code was duplicated (with minor differences, which I indicate below)
  * if the node was drained, under Windows the timer resolution (added in [CASSANDRA-9634])
was not reset, since the node was considered "already drained".
  * same was happening with post-shutdown hooks, since [here|]
we'll return from runnable, since those services were shut down during {{drain}} [here|].

This is one of the reasons I was advocating for a single consistent drain process. 
I also suggest disallowing re-enabling auto-compaction, binary, gossip, handoff and thrift
to ensure that we do not need to re-stop them in the final shutdown hook. Operator can not
bring the node into "working" state after drain without restart anyways (one of the reasons
is the fact that commit log is shut down by that time), and it was most likely never intended
to do so. However, it might be useful for operator to run compactions on the drained node,
so we only shut down compaction manager later. 

I've made a comparison table to make it easier to see what {{drain()}} method was doing compared
to {{drainOnShutdown}} runnable:

|| nodetool drain || shutdown drain hook |
| disables autocompaction               |                                         |
| shuts down compaction manager | |
| recycles commitlog segment recycling |                                         |
| shuts down batchlog and hints earlier |                                         |
|                                       | flushes only tables with durable_writes |
|                                       | clears set timer resolution for windows |

I've combined the two processes, made clearer distinctions to allow running things in {{drainOnShutdown}}.
Since we can run all the items from the {{nodetool drain}} part of the list during the normal
node shutdown, the code got a bit simpler, too (the only difference is now logging). 

Preliminary version of the update (also, CI pending): 

(I've discussed the change "in theory" with [~slebresne], although it's still worth for someone
to take a deeper look at it, I'll ask around)

> Add hooks to StorageService shutdown
> ------------------------------------
>                 Key: CASSANDRA-12461
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Anthony Cozzie
>            Assignee: Anthony Cozzie
>             Fix For: 3.x
>         Attachments: 0001-CASSANDRA-12461-add-C-support-for-shutdown-runnables.patch
> The JVM will usually run shutdown hooks in parallel.  This can lead to synchronization
problems between Cassandra, services that depend on it, and services it depends on.  This
patch adds some simple support for shutdown hooks to StorageService.
> This should nearly solve CASSANDRA-12011

This message was sent by Atlassian JIRA

View raw message