b4ea6516de
When api_nb module queries each table in Zookeeper or RMC, if there is no keys in the table, the exception is raised. After a key is created in that table, the exception no longer appears. In order to get rid of the exception, we first introduce create_table and delete_table api for db-api module and then we initialize all the tables at the system initialization. Change-Id: I7df838b0e248e808619e17c645efbb71cac91f9e Closes-Bug: #1548012
94 lines
3.5 KiB
Bash
94 lines
3.5 KiB
Bash
#!/bin/bash
|
|
#
|
|
#
|
|
# ``plugin.sh`` calls the following methods in the sourced driver:
|
|
#
|
|
# - nb_db_driver_install_server
|
|
# - nb_db_driver_install_client
|
|
# - nb_db_driver_start_server
|
|
# - nb_db_driver_stop_server
|
|
# - nb_db_driver_clean
|
|
|
|
RAMCLOUD=$DEST/ramcloud
|
|
RAMCLOUD_LIB=$RAMCLOUD/lib
|
|
RAMCLOUD_BIN=$RAMCLOUD/bin
|
|
RAMCLOUD_MASTER_IP=${RAMCLOUD_MASTER_IP:-"$HOST_IP"}
|
|
RAMCLOUD_COORDINATOR_IP=${RAMCLOUD_COORDINATOR_IP:-"$HOST_IP"}
|
|
RAMCLOUD_MASTER_PORT=${RAMCLOUD_MASTER_PORT:-'21221'}
|
|
RAMCLOUD_COORDINATOR_PORT=${RAMCLOUD_COORDINATOR_PORT:-'21222'}
|
|
RAMCLOUD_TRANSPORT=${RAMCLOUD_TRANSPORT:-'fast+udp'}
|
|
|
|
LIB_BOOST_MAJOR_VERSION=1
|
|
LIB_BOOST_MINOR_VERSION=54
|
|
|
|
function nb_db_driver_install_server {
|
|
if is_service_enabled df-rcmaster ; then
|
|
echo "Installing Dependencies"
|
|
if is_ubuntu; then
|
|
boost_program=libboost-program-options"$LIB_BOOST_MAJOR_VERSION"."$LIB_BOOST_MINOR_VERSION"
|
|
boost_filesystem=libboost-program-options"$LIB_BOOST_MAJOR_VERSION"."$LIB_BOOST_MINOR_VERSION"
|
|
protobuf_lib=libprotobuf8
|
|
elif is_suse || is_oraclelinux; then
|
|
boost_program=libboost_program_options"$LIB_BOOST_MAJOR_VERSION"_"$LIB_BOOST_MINOR_VERSION"_0
|
|
boost_filesystem=libboost_filesystem"$LIB_BOOST_MAJOR_VERSION"_"$LIB_BOOST_MINOR_VERSION"_0
|
|
protobuf_lib=libprotobuf8
|
|
elif is_fedora; then
|
|
if [[ "$os_RELEASE" -ge "21" ]]; then
|
|
echo "Boost version 54 is not available for fedora > 20"
|
|
#TODO(gampel) add support for fedora > 20
|
|
else
|
|
boost_program=boost_program_options"$LIB_BOOST_MAJOR_VERSION"_"$LIB_BOOST_MINOR_VERSION"_0
|
|
boost_filesystem=boost_filesystem"$LIB_BOOST_MAJOR_VERSION"_"$LIB_BOOST_MINOR_VERSION"_0
|
|
fi
|
|
protobuf_lib=protobuf
|
|
fi
|
|
install_package "$boost_program" "$boost_filesystem" "$protobuf_lib"
|
|
echo "Installing RAMCloud server"
|
|
git_clone https://github.com/dsivov/RamCloudBin.git $RAMCLOUD
|
|
echo export LD_LIBRARY_PATH="$RAMCLOUD_LIB":"$LD_LIBRARY_PATH" | tee -a $HOME/.bashrc
|
|
fi
|
|
}
|
|
|
|
function nb_db_driver_install_client {
|
|
echo "Installing RAMCloud client"
|
|
git_clone https://github.com/dsivov/RamCloudBin.git $RAMCLOUD
|
|
}
|
|
|
|
function nb_db_driver_status_server
|
|
{
|
|
if is_service_enabled df-rccoordinator ; then
|
|
TEMP_PIDS=`ps cax | grep coordinator`
|
|
if [ -z "$TEMP_PIDS" ]; then
|
|
return 1
|
|
fi
|
|
fi
|
|
if is_service_enabled df-rcmaster ; then
|
|
TEMP_PIDS=`ps cax | grep " server"`
|
|
if [ -z "$TEMP_PIDS" ]; then
|
|
return 1
|
|
fi
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
function nb_db_driver_start_server {
|
|
if is_service_enabled df-rccoordinator ; then
|
|
$RAMCLOUD_BIN/coordinator -C ${RAMCLOUD_TRANSPORT}:host=${RAMCLOUD_COORDINATOR_IP},port=${RAMCLOUD_COORDINATOR_PORT} 2&> /dev/null || true &
|
|
fi
|
|
if is_service_enabled df-rcmaster ; then
|
|
sleep 10
|
|
$RAMCLOUD_BIN/server -L ${RAMCLOUD_TRANSPORT}:host=${RAMCLOUD_MASTER_IP},port=${RAMCLOUD_MASTER_PORT} -C ${RAMCLOUD_TRANSPORT}:host=${RAMCLOUD_COORDINATOR_IP},port=${RAMCLOUD_COORDINATOR_PORT} 2&> /dev/null || true &
|
|
echo "Sleep for 20 secs. Giving time for db to start working!!!"
|
|
sleep 20
|
|
fi
|
|
}
|
|
|
|
function nb_db_driver_stop_server {
|
|
if is_service_enabled df-rccoordinator ; then
|
|
sudo killall coordinator 2&> /dev/null || true
|
|
fi
|
|
if is_service_enabled df-rcmaster ; then
|
|
sudo killall server 2&> /dev/null || true
|
|
fi
|
|
}
|