project-tsurugi / tateyama Goto Github PK
View Code? Open in Web Editor NEWApplication Infrastructure for Tsurugi
License: Apache License 2.0
Application Infrastructure for Tsurugi
License: Apache License 2.0
oltp killすると、tateyama-serverが作成したipc接続やサーバ状態提供用の共有メモリを消去しないまま残る。これはtateyama-serverが制御不能になり、SIGKILLを送って終了させる、という状況を想定した場合は不可避の動作である。
これらのファイルは、現在の実装では、oltp killコマンド内でtateyama-serverプロセスをkillした後に消去していたが、この方法は脆弱との指摘があったため、oltp killでは消去せず、次回のoltp startによるtateyama-serverの起動時に消去するように変更する。
から参照されている
は、ファイル配置も名前空間も不適切なので修正する。
は .cpp
に追い出せるので、周辺併せて configuration.cpp
に definition を移動する。
は、以下の修正を加える。
configuration.cpp
のみになっているので、 src/
以下に移動するか、 configuration.cpp
に埋め込むtateyama::api::configuration::details
tateyama/include/tateyama/api/configuration.h
Lines 144 to 146 in 5f0b295
map_
は単なる std::unordered_map
であり、明示的に開放する意味がない。
configuration
は tateyama
内の設定情報を表す部品であり、それをどこから読むかは起動シーケンスである tateyama-bootstrap
側の責任。責任の範囲があいまいになっているので、ここではファイルを指定したほうが適切かと。
tateyama/include/tateyama/api/configuration.h
Line 111 in 5f0b295
#16 と同様に、責任範囲が不明瞭になっている。
特にDockerでの利用時に、標準的な内容を定義した構成ファイルに対して設定を一部変更したい(特にエンドポイント系)。コンテナ上の設定ファイルを上書きするのは大変であるのと管理上も望ましくなく、ブートストラップのコマンドオプション、もしくは環境変数で構成ファイルの内容を上書きしたい。
Dockerから構成の内容を上書きする場合、Dockerの起動方法によっては環境変数でしかパラメータを渡すことが出来ない(コマンドラインオプションを渡せない)。そのため、ブートストラップがコマンドオプションのみの対応の場合は、Dockerのエントリポイントスクリプトで環境変数をコマンドオプションに変換して渡すことになる。
この機能の利用イメージはPostgreSQLのDockerイメージとほぼ同じ。
https://hub.docker.com/_/postgres
関連する議論のスレッド:
https://nautilus-rd.slack.com/archives/GB4QT920L/p1654741714845849
プロセス起動時に作られる tsurugi.pid
が構成ファイルと同じディレクトリに作られるため、rootでインストールし、一般ユーザで起動するとPermission failedで起動に失敗する。
/tmp/<mangled/path/to/conf>
など、インストール構成に依存しない箇所に配置すべき。
関連する議論のSlackスレッド:
https://nautilus-rd.slack.com/archives/GB4QT920L/p1655176329393129?thread_ts=1655106121.943689&cid=GB4QT920L
oltp backup createでWALがコピーされない
以下をTsurugi Dockerイメージのコンテナ内で実行する。
#!/bin/bash
/usr/lib/tsurugi/bin/tgsql exec -c tcp://localhost:12345 "create table demo(pk int primary key, col2 bigint, col3 float, col4 double, col5 char(4), cal6 varchar(10), col7 varchar(3))" --no-auth
/usr/lib/tsurugi/bin/tgsql exec -c tcp://localhost:12345 "insert into demo(pk,col2,col3,col4,col5,cal6,col7) values (1,1,1.1,1.1,'1','1111', NULL)" --no-auth
/usr/lib/tsurugi/bin/tgsql exec -c tcp://localhost:12345 "insert into demo(pk,col2,col3,col4,col5,cal6,col7) values (2,2,2.2,2.2,'2','2222', NULL)" --no-auth
/usr/lib/tsurugi/bin/tgsql exec -c tcp://localhost:12345 "insert into demo(pk,col2,col3,col4,col5,cal6,col7) values (3,3,3.3,3.3,'3','3333', NULL)" --no-auth
/usr/lib/tsurugi/bin/tgsql exec -c tcp://localhost:12345 "select * from demo" --no-auth
echo "check TsurugiDB is running..."
/usr/lib/tsurugi/bin/oltp status --conf /usr/lib/tsurugi/conf/tsurugi.ini
echo "shutdown TsurugiDB..."
/usr/lib/tsurugi/bin/oltp shutdown --conf /usr/lib/tsurugi/conf/tsurugi.ini
sleep 3
echo "check TsurugiDB is stopped..."
/usr/lib/tsurugi/bin/oltp status --conf /usr/lib/tsurugi/conf/tsurugi.ini
echo "call oltp quiesce to be exclusive mode ..."
/usr/lib/tsurugi/bin/oltp quiesce --conf /usr/lib/tsurugi/conf/tsurugi.ini
sleep 3
echo "check TsurugiDB status after calling oltp quiesce..."
/usr/lib/tsurugi/bin/oltp status --conf /usr/lib/tsurugi/conf/tsurugi.ini
echo "create backup..."
MONITOR_LOG_DIR=/tmp/bk_offline
BK_DATA_DIR=/tmp/bk_offline_data
mkdir $MONITOR_LOG_DIR
mkdir $BK_DATA_DIR
/usr/lib/tsurugi/bin/oltp backup create ${BK_DATA_DIR} --monitor ${MONITOR_LOG_DIR}/monitor.log --conf /usr/lib/tsurugi/conf/tsurugi.ini --force
echo "------------"
ls -al ${BK_DATA_DIR}
echo "------------"
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.