Project

General

Profile

Actions

Enhancement(機能追加・改善) #1674

open

DBレプリケーション運用時に、参照系クエリの参照先を明示的にmasterに切り替えたい

Added by Naoya Tozuka over 14 years ago. Updated almost 13 years ago.

Status:
New(新規)
Priority:
Normal(通常)
Assignee:
-
Target version:
Start date:
2010-10-14
Due date:
% Done:

0%

Estimated time:

Description

OpenPNE3の運用でMySQLのレプリケーション機能を利用する場合、スレーブ遅延の影響を回避するためにSELECTクエリの参照先を明示的にmasterに切り替えたい場合があります。

github.com/tozuka/OpenPNE3.git の topic-force-master-201010 ブランチに

  • コード中の特定の区間でSELECTクエリの参照先を強制的にmasterに
  • アクション単位で   〃

するためのパッチをコミットしています (1d875793f7a6d614ce82) 。取り込みをお願いします。

本パッチの用法

1. コード中の特定の区間で強制的にmaster参照

masterを強制参照したい区間を

  opDoctrineQuery::beginForcingMasterConnection();

  ...

  opDoctrineQuery::endForcingMasterConnection();
で囲みます。

アクション終了までmaster強制参照のままでよい場合は endForcing... は不要です。

アクション全体でmasterを強制参照したい場合は次の「アクション単位で…」をご検討ください。

2. アクション単位で強制的にmaster参照

masterを強制参照したいアクションについて、apps/XX_frontend/config/routing.yml 等適切な箇所で

someModule_someAction:
  url: /someModule/someAction
  class: opForceMasterRoute
  param: { module: someModule, action: someAction }
のように記述してください。(記述例は config/routing.yml.sample にあります)

Actions #1

Updated by Mutsumi Imamura over 13 years ago

  • Target version set to OpenPNE 3.7.0
Actions #2

Updated by Shouta Kashiwagi almost 13 years ago

  • Target version changed from OpenPNE 3.7.0 to 252
Actions #3

Updated by Shouta Kashiwagi almost 13 years ago

  • Target version changed from 252 to OpenPNE 3.8.x
Actions

Also available in: Atom PDF