rapid7 / cassandra-utils Goto Github PK
View Code? Open in Web Editor NEWA utility to reporting metrics on the state of a Cassandra node.
License: MIT License
A utility to reporting metrics on the state of a Cassandra node.
License: MIT License
In v0.3.2, the token_cache
method creates a new File
in create, read, write, truncate mode. This means the file is always "empty" when cached_tokens
is called. Instead, we should be creating the file with a custom mode, and caching the File
object.
def token_cache
mode = File::CREAT | File::RDWR | File::SYNC
@token_cache ||= File.new(token_cache_path, mode)
end
That will create the file if it doesn't already exist, open the file for reading and writing, and allow us to eliminate the flush
call when writing tokens.
We also need to call File.seek
before reading tokens so that we read them from the beginning of the file.
token_cache.seek 0
token_cache.read
And we need to call File.seek
and File.truncate
before writing tokens so we overwrite any existing data in the file.
token_cache.seek 0
token_cache.truncate 0
token_cache.write data.to_json
cassandra-utils runs both stats and autoclean (automatic cleanup scheduling). It'd be nice to allow users to run stats and autoclean independently if desired. This could either be a series of command line switches e.g. --no-autoclean
and --no-stats
or a config file with a list of tasks to run.
Currently the autoclean code uses nodetool ring
to get the list of tokens the node owns. This returns the token list for all nodes in the ring, which is kind of an expensive cal. We should use nodetool info --tokens
instead.
There's a bug in v0.3.1-beta.1 where we'll start nodetool cleanup
even if we've already found an existing cleanup process running. We should add a regression test to capture this bug when we fix it.
We're caching the Mixlib::ShellOut instance when running commands. This has bitten us before (see PR #33 in daemon_runner). We should either skip the caching or just change this to use daemon_runner.
In version 0.3.1-beta-2 the compaction and cleanup stats are no longer being reported.
This was broken in PR #18 when Mixlib::ShellOut
was changed to DaemonRunner::ShellOut
. The Cassandra::Utils::CLI::Base#run!
method wasn't changed, so it's still trying to call Mixlib::ShellOut#run_command
and Mixlib::ShellOut#error!
instead of DaemonRunner::ShellOut#run!
.
Interestingly, there don't appear to be any errors or warnings in the logs about missing method calls. We should look into what's eating those exceptions.
When the autoclean task saves a list of tokens, it will always have version 0.0.1. The code that returns the version is looking for a VERSION file. We don't have a VERSION file, since we're using thor-scmversion and using Github tags.
We should update our CI process to create a VERSION file that gets packaged into the gem when it's built.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.