Skip to content
Browse files

Removing some old shell scripts + Adding a JMX to RO stores to get ch…

…unk information
  • Loading branch information...
1 parent ee3d2f6 commit 78a2fbf85101c4d4c4709ffbeb696ff4ac4332ef @rsumbaly rsumbaly committed May 11, 2011
View
41 bin/voldemort-config.sh
@@ -1,41 +0,0 @@
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Standard include defining ways to determine VOLDEMORT_HOME, etc.
-
-#export VOL_SSH_OPTS=""
-
-this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '.*/.*' > /dev/null; then
- this="$link"
- else
- this=`dirname "$this"`/"$link"
- fi
-done
-
-# convert relative path to absolute path
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
-this="$bin/$script"
-
-export VOL_HOME=`dirname "$this"`/..
-export VOL_CONF_DIR="$VOL_HOME"
-
View
81 bin/voldemort-destroy-all-data.sh
@@ -1,81 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Kills all the BDB data files after showing affected nodes and the
-# respective data directory path. User must enter 'Yes' before it proceeds.
-
-
-usage="Usage: voldemort-destroy-all-data.sh [--config <conf-dir>]"
-
-bin=`dirname "$0"`
-bin=`cd "$bin"; pwd`
-
-. "$bin/voldemort-config.sh"
-
-if [ "$#" != "2" ] && [ "$#" != "0" ]
-then
- echo $usage
- exit 1
-fi
-
-#check to see if the conf dir is given as an optional argument
-if [ $# -eq 2 ]
-then
- if [ "--config" = "$1" ]
- then
- shift
- confdir=$1
- shift
- VOL_CONF_DIR=$confdir
- nodeid=$1
- fi
-fi
-
-HOSTLIST="$VOL_CONF_DIR/config/nodes"
-datadir="$(cd $VOL_CONF_DIR && pwd)/data/bdb"
-
-# Make user confirm the selection
-echo ------------------------------------------------------------------
-echo ------------------------------------------------------------------
-echo
-echo You are about to delete all data on the following nodes:
-echo
-echo $(cat $HOSTLIST)
-echo
-echo in $datadir
-echo
-echo
-echo ------------------------------------------------------------------
-echo ------------------------------------------------------------------
-
-echo -n "Type 'Yes' if you would like to continue: "
-read a
-if [[ $a != "Yes" ]]
-then
- echo "Didn't get a 'Yes' input. Quitting for now."
- exit 1
-fi
-
-
-for node in `cat "$HOSTLIST"`; do
- echo $node: Removing data directory $datadir
- ssh $VOL_SSH_OPTS $node "rm -rf $datadir" &
-done
-wait
-echo
-echo "Done destroying the data directories."
View
57 bin/voldemort-node-id.sh
@@ -1,57 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Script to remove and change the node.id from local server.properties. Is
-# also used by the sync script across all nodes.
-
-usage="Usage: voldemort-node-id.sh [--config <conf-dir>] <node id>"
-
-bin=`dirname "$0"`
-bin=`cd "$bin"; pwd`
-
-. "$bin/voldemort-config.sh"
-
-if [ $# -eq 0 ] || [ $# -eq 2 ] || [ $# -gt 3 ]
-then
- echo $usage
- exit 1
-fi
-
-nodeid=$1
-
-#check to see if the conf dir is given as an optional argument
-if [ $# -eq 3 ]
-then
- if [ "--config" = "$1" ]
- then
- shift
- confdir=$1
- shift
- VOL_CONF_DIR=$confdir
- nodeid=$1
- fi
-fi
-
-SERVER_PROPERTIES="$VOL_CONF_DIR/config/server.properties"
-
-grep -v "node.id" $SERVER_PROPERTIES > /tmp/$$
-echo "node.id=$nodeid" >> /tmp/$$
-cp -f /tmp/$$ $SERVER_PROPERTIES
-rm /tmp/$$
-
-echo $(hostname): node.id=$nodeid
View
56 bin/voldemort-start-all.sh
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Name says it all. Like all the other scripts the --config parameter allow
-# you to determine, which configuration to use. Log output goes into a logs
-# directory on each node (will be auto created if it doesn't exist).
-
-
-usage="Usage: voldemort-start-all.sh [--config <conf-dir>]"
-
-bin=`dirname "$0"`
-bin=`cd "$bin"; pwd`
-
-. "$bin/voldemort-config.sh"
-
-if [ "$#" != "0" ] && [ "$#" != "2" ]
-then
- echo $usage
- exit 1
-fi
-
-#check to see if the conf dir is given as an optional argument
-if [ $# -eq 2 ]
-then
- if [ "--config" = "$1" ]
- then
- shift
- confdir=$1
- shift
- VOL_CONF_DIR=$confdir
- nodeid=$1
- fi
-fi
-
-export HOSTLIST="$VOL_CONF_DIR/config/nodes"
-
-for node in `cat "$HOSTLIST"`; do
- ssh $VOL_SSH_OPTS $node "mkdir $VOL_HOME/logs 2>/dev/null; nohup $bin/voldemort-server.sh `cd $VOL_CONF_DIR && pwd` >$VOL_HOME/logs/voldemort-server.log 2>$VOL_HOME/logs/voldemort-server.err </dev/null& " &
-done
-wait
-
View
58 bin/voldemort-stop-all.sh
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Stops the local node. Note: As a future enhancement the PID of the current
-# running voldemort server could be saved, so finding out, which Java process
-# to end would be more reliable in case there are multiple Voldemort
-# instances running on the same host under the same user. The PID would be
-# ideally saved on a per config basis.
-
-
-usage="Usage: voldemort-stop-all.sh [--config <conf-dir>]"
-
-bin=`dirname "$0"`
-bin=`cd "$bin"; pwd`
-
-. "$bin/voldemort-config.sh"
-
-if [ "$#" != "0" ] && [ "$#" != "2" ]
-then
- echo $usage
- exit 1
-fi
-
-#check to see if the conf dir is given as an optional argument
-if [ $# -eq 2 ]
-then
- if [ "--config" = "$1" ]
- then
- shift
- confdir=$1
- shift
- VOL_CONF_DIR=$confdir
- nodeid=$1
- fi
-fi
-
-export HOSTLIST="$VOL_CONF_DIR/config/nodes"
-
-for node in `cat "$HOSTLIST"`; do
- ssh $VOL_SSH_OPTS $node "$bin/voldemort-stop.sh" &
-done
-wait
-
View
73 bin/voldemort-sync-config.sh
@@ -1,73 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 bebo, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Syncs the entire voldemort install directory over to the other nodes using rsync. The
-# script is smart enough to exclude the BDB data directories (if they are in
-# their standard locations) to avoid overwriting data on the nodes. Once
-# everything is synced over it prepares node.ids for each node and ships them
-# over. The script is also driven by the 'nodes' file.
-
-usage="Usage: voldemort-sync-config.sh [--config <conf-dir>]"
-
-bin=`dirname "$0"`
-bin=`cd "$bin"; pwd`
-
-. "$bin/voldemort-config.sh"
-
-#check to see if the conf dir is given as an optional argument
-if [ $# -eq 2 ]
-then
- if [ "--config" = "$1" ]
- then
- shift
- confdir=$1
- shift
- VOL_CONF_DIR=$confdir
- fi
-fi
-
-export HOSTLIST="$VOL_CONF_DIR/config/nodes"
-
-echo -n "Syncing config changes... "
-
-# don't copy the local berkeley db files to all nodes
-excludefile="/tmp/rsync-excludes$$"
-echo "bdb" > $excludefile
-cd `cd $VOL_HOME && pwd`
-find config -name bdb -type d >> $excludefile
-cd -
-
-# Sync everything but BDB files over
-for node in `cat "$HOSTLIST"`; do
- rsync $VOL_SSH_OPTS --exclude-from $excludefile --delete -ra `cd $VOL_HOME && pwd`/ $node:`cd $VOL_HOME && pwd` && echo -n "$node " &
-done
-# Wait until config is all pushed out.
-wait
-rm $excludefile
-echo "done!"
-
-echo "Reassigning node IDs..."
-nodeid=0
-abs_conf_dir=`cd $VOL_CONF_DIR && pwd`
-for node in `cat "$HOSTLIST"`; do
- ssh $node $bin/voldemort-node-id.sh --config $abs_conf_dir $nodeid &
- nodeid=$[$nodeid + 1]
-done
-wait
-echo "Done syncing Voldemort home directory and reassigning node IDs"
-exit 0
View
17 config/single_node_cluster/config/cluster.xml
@@ -5,22 +5,7 @@
<host>localhost</host>
<http-port>8081</http-port>
<socket-port>6666</socket-port>
- <partitions>0, 3</partitions>
+ <partitions>0, 1</partitions>
</server>
- <server>
- <id>1</id>
- <host>localhost</host>
- <http-port>8081</http-port>
- <socket-port>6666</socket-port>
- <partitions>1, 4</partitions>
- </server>
- <server>
- <id>2</id>
- <host>localhost</host>
- <http-port>8081</http-port>
- <socket-port>6666</socket-port>
- <partitions>2, 5</partitions>
- </server>
-
</cluster>
View
2 config/single_node_cluster/config/stores.xml
@@ -5,7 +5,7 @@
<description>Test store</description>
<owners> harry@hogwarts.edu, hermoine@hogwarts.edu </owners>
<routing>client</routing>
- <replication-factor>3</replication-factor>
+ <replication-factor>1</replication-factor>
<required-reads>1</required-reads>
<required-writes>1</required-writes>
<key-serializer>
View
15 src/java/voldemort/store/readonly/ReadOnlyStorageEngine.java
@@ -23,6 +23,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -134,6 +135,20 @@ public ChunkedFileSet getChunkedFileSet() {
}
/**
+ * Returns a string representation of map of chunk id to number of chunks
+ *
+ * @return String of map of chunk id to number of chunks
+ */
+ @JmxGetter(name = "getChunkIdToNumChunks", description = "Returns a string representation of the map of chunk id to number of chunks")
+ public String getChunkIdToNumChunks() {
+ StringBuilder builder = new StringBuilder();
+ for(Entry<Object, Integer> entry: fileSet.getChunkIdToNumChunks().entrySet()) {
+ builder.append(entry.getKey().toString() + " - " + entry.getValue().toString() + ", ");
+ }
+ return builder.toString();
+ }
+
+ /**
* Open the store with the version directory specified. If null is specified
* we open the directory with the maximum version
*

0 comments on commit 78a2fbf

Please sign in to comment.
Something went wrong with that request. Please try again.