Skip to content

Commit

Permalink
Handle the corner case.
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji committed Apr 10, 2024
1 parent 756625e commit d60751a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions docker/vineyard-fluid-fuse/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,33 @@ while true; do

echo "write vineyard ipc socket and rpc endpoint to vineyard configuration YAML..."
write_yaml_config "$VINEYARD_RPC_ENDPOINT"

echo "check whether vineyard socket symlink is created..."
if [ ! -S $SOCKET_FILE ] && [ -S $MOUNT_DIR/vineyard-worker.sock ]; then
echo "create a hard link of vineyard socket..."
ln $MOUNT_DIR/vineyard-worker.sock $SOCKET_FILE
else
echo "$SOCKET_FILE exists."
fi
# wait for a minute so that the hard link of vineyard socket can be checked again
sleep 60

# avoid vineyardd restart
echo "check whether the inode number is same..."
if [ -S $SOCKET_FILE ] && [ -S $MOUNT_DIR/vineyard-worker.sock ]; then
SOCKET_INODE=$(ls -i $SOCKET_FILE | awk '{print $1}')
MOUNT_INODE=$(ls -i $MOUNT_DIR/vineyard-worker.sock | awk '{print $1}')
if [ "$SOCKET_INODE" != "$MOUNT_INODE" ]; then
echo "inode number is different, remove the hard link of vineyard socket"
rm -f $SOCKET_FILE
fi
fi

# avoid vineyard worker crash
echo "check whether vineyard worker socket exists..."
if [ ! -S $MOUNT_DIR/vineyard-worker.sock ]; then
echo "vineyard worker socket does not exist, remove the hard link of vineyard socket"
rm -f $SOCKET_FILE
fi

# wait for 5 seconds before checking again
sleep 5
done

0 comments on commit d60751a

Please sign in to comment.