Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
hbstyle-2014-12-11
Search
rrreeeyyy
December 11, 2014
Technology
8
2.9k
hbstyle-2014-12-11
MySQL 5.6.10 以下に存在する レプリケーションのバグと原因特定について (Heartbeats 社内勉強会 2014/12/11)
rrreeeyyy
December 11, 2014
Tweet
Share
More Decks by rrreeeyyy
See All by rrreeeyyy
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
180
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
3.6k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.2k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
10
2.4k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
8.6k
「信頼性」を保ちつつ大規模サービスをリニューアルする / cookpad-tech-kitchen-service-embedded-sres
rrreeeyyy
11
12k
Cookpad and Prometheus
rrreeeyyy
6
20k
SRE-Lounge-8-Cookpad-Microservice-Architecture-Overview
rrreeeyyy
5
5.3k
A survey of anomaly detection methodologies for web system
rrreeeyyy
5
1.2k
Other Decks in Technology
See All in Technology
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
170
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
5分でわかるDuckDB
chanyou0311
10
3.2k
生成AIのガバナンスの全体像と現実解
fnifni
1
190
マイクロサービスにおける容易なトランザクション管理に向けて
scalar
0
140
C++26 エラー性動作
faithandbrave
2
770
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
190
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
130
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
podman_update_2024-12
orimanabu
1
280
kargoの魅力について伝える
magisystem0408
0
210
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
Building an army of robots
kneath
302
44k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
We Have a Design System, Now What?
morganepeng
51
7.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
Documentation Writing (for coders)
carmenintech
66
4.5k
BBQ
matthewcrist
85
9.4k
Making the Leap to Tech Lead
cromwellryan
133
9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
The Language of Interfaces
destraynor
154
24k
Visualization
eitanlees
146
15k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Transcript
MySQL ϨϓϦέʔγϣϯͷόάͱ ݪҼಛఆʹ͍ͭͯ YOSHIKAWA Ryota hbstyle-2014-12-11 1
ࣄ • MySQL (5.5.32) ʹͯɺϨϓϦέʔγϣϯͷෆ۩߹͕ൃੜ • DDL શͯө͞ΕΔ • DML
ಛఆͷςʔϒϧʹͯө͞Εͳ͍ • Slave_(IO|SQL)_Running ڞʹ Yes • Τϥʔແ͠ • MySQL 5.6.10 Ҏલશ͕ͯ͜ͷόάͷର YOSHIKAWA Ryota hbstyle-2014-12-11 2
ݪҼ • MasterDB ͷ table_id ͕ UINT_MAX Λ͑ͨ߹ʹൃੜ • SlaveDB
ͷ table_id ͕Φʔόʔϑϩʔ • MasterDB ͕͍࣋ͬͯΔ table_id ͱ, ϨϓϦέʔγϣϯͰୡ͞ΕΔ table_id ʹෆ߹͕ൃੜ • binlog ͕ Row|Mixed ͷϨϓϦέʔγϣϯͰӨڹ • ৄ͘͠ http://bugs.mysql.com/bug.php?id=67352 YOSHIKAWA Ryota hbstyle-2014-12-11 3
ݪҼ (ଓ͖) • Master ͕ཧ͢Δ table_id (table_map_id) ulong •
64bit Linux ڥͰ 18446744073709551615 ͕࠷େ • Slave ͕ཧ͢Δ table_id uint • 64bit Linux ڥͰ 4294967295 ͕࠷େ • CREATE/DROP/TRUNCATE Ͱ table_id ͕૿Ճ͍ͯ͘͠ • ෆ߹͕ى͖Δͱ Slave σʔλΛߋ৽Ͱ͖ͳ͘ͳΔ YOSHIKAWA Ryota hbstyle-2014-12-11 4
• σόοάϩά # Master Ͱcheck_repl ςʔϒϧͷॻ͖ࠐΈΛͨ࣌͠ͷ Slave ͷσόοάϩά table_mapping::set_table(ulong,TABLE*): enter:
table_id: 20497567 table: 0x3d361f0 (check_repl) table_mapping::set_table(ulong,TABLE*): info: tid 20497567 -> table 0x3d361f0 (check_repl) table_mapping::get_table(ulong): enter: table_id: 4315464863 table_mapping::get_table(ulong): info: tid 4315464863 is not mapped! # ... 20497567 = 4315464863 - (4294967295 + 1) # ... (4294967295 ... UINT_MAX) • ιʔείʔυ * table_map_id > # grep -n "ulong table_map_id" sql/table.h > 645: ulong table_map_id; /* for row-based replication */ * table_id > # grep -n "uint table_id" sql/table.h > 1457: uint table_id; /* table id (from binlog) for opened table */ YOSHIKAWA Ryota hbstyle-2014-12-11 5
Ͳ͏ͬͯಛఆ͔ͨ͠ YOSHIKAWA Ryota hbstyle-2014-12-11 6
Day1 YOSHIKAWA Ryota hbstyle-2014-12-11 7
ਪଌʹΑΔԾઆݕূͷ܁Γฦ͠ • ਓ͕ؒ૾Ͱ͖Δൣғͷόάͩͱ͜ͷํ๏͕ߴ(ܦݧతʹ) • ಉ༷ͷݱ(slave ߋ৽ෆՄ)Λ google Ͱͻͨ͢Βݕࡧɾݕূ • ਓؒͷ૾Ͱ͖ͳ͍ൣғͷόάͩͱϋϚΔ
• લྫͷݟ͕ݕࡧͮ͠Β͍/ແ͍߹ಛʹ • ܦݧΛੵΉࣄͰൣғΛ͛Δ͜ͱՄೳͳؾ͢Δ YOSHIKAWA Ryota hbstyle-2014-12-11 8
Day2 YOSHIKAWA Ryota hbstyle-2014-12-11 9
ࣄͷ࠶ݱɾΓ͚ • ࣗͷݕࡧɾਪଌग़དྷΔϨϕϧΛ͍͑ͯΔࣄΛೝࣝ • ຊ൪ػͷ binlog ΛோΊͯոͦ͠͏ͳૢ࡞Λચ͍ग़͢ • Slave ͷσʔλΛݟͯԿ࣌ࠒʹෆ߹͕ى͖͔ͨ֬ೝ
• ෆ۩߹͕ى͖ͯΔ DB ͰࣄͷΓ͚ • σʔλϑΝΠϧͷ༰ྔຊʹ૿͍͑ͯͳ͍͔ • ϦϨʔϩάʹॻ͖ࠐΈ͕͋Δ͔... YOSHIKAWA Ryota hbstyle-2014-12-11 10
Day3 YOSHIKAWA Ryota hbstyle-2014-12-11 11
࠶ݱࡁΈڥͰͷσόοά • ো͕ى͖͍ͯͨ Master ʹผͷ Slave Λܨ͙ͱ࠶ݱग़དྷͨ • Slave ʹؔΘΒͣো͕ى͖Δ
=> Master ͓͔ͦ͠͏ • Slave ͷ MySQL Λ Debug ༗ޮͰϏϧυͯ͠ܨ͍ͰΈΔ cmake . -DWITH_DEBUG=1 -DMYSQL_MAINTAINER_MODE=0 • ਖ਼ৗͳ Master ʹܨ͍ͩ࣌ͷϩάͱҟৗͳϩάΛݟൺΔ • ϩάͱιʔείʔυΛൺֱͯ͠Ͳ͜ͰԿ͕ى͖ͯΔ͔Ѳ YOSHIKAWA Ryota hbstyle-2014-12-11 12
ʹཱͬͨπʔϧ • mysqlbinlog (binlog, relaylog ղੳ) • tcpdump & Percona
Toolkit (ύέοτɾσʔλෆ߹ௐࠪ) • icdiff (֤छϩάͷൺֱ) • gdb (MySQL ͷσόοά) • vim & ctags & Unite grep ... (ιʔείʔυϦʔσΟϯά) YOSHIKAWA Ryota hbstyle-2014-12-11 13
ʹཱͬͨݟ (1) • hbstyle Ͱͷݟ • @indigo13love ͞Μͷੲͷൃද • sql/slave.cc
ϨϓϦέʔγϣϯͷݟ • ܭࢉػՊֶͷݟ • MySQL Packet ͷϔομ͙Β͍ͳΒಡΊΔ • ֶ෦ͷ࣌ʹύέοτோΊͨݟ YOSHIKAWA Ryota hbstyle-2014-12-11 14
ʹཱͬͨݟ (2) • ιʔείʔυϦʔσΟϯάͷݟ • ֶ෦࢛Ͱ৭ΜͳιϑτΣΞͷιʔείʔυಡΜͩݟ • Apache, Nginx, Keepalived,
LVS ... • ϏϏΒͳ͍͜ͱ • ϩάͱಥ͖߹ΘͤͯಡΉ • πʔϧΛָͬͯͯ͠ಡΉ YOSHIKAWA Ryota hbstyle-2014-12-11 15
[demo] πʔϧͷ͍ํͱ͔ιʔεಡΈͱ͔ͪΐͬͱ͚ͩ YOSHIKAWA Ryota hbstyle-2014-12-11 16
ল YOSHIKAWA Ryota hbstyle-2014-12-11 17
Don't guess, measure! — Robert C. Pike YOSHIKAWA Ryota hbstyle-2014-12-11
18
ল • ਪଌ͢ΔͳɺܭଌͤΑ • ύϑΥʔϚϯε͚ͩͰͳ͘όάಉ͡ • (ఆͷ)؆୯ͳόάΛ૬खʹͯ͠ΔͱΕΔ͜ͱ͋Δ • ࣄɾݪҼΓ͚ɾιʔείʔυ͕શͯ •
ϩάΛݟΔɾιʔείʔυΛݟΔ YOSHIKAWA Ryota hbstyle-2014-12-11 19
• νϟοτͱ͔ͷݺͼ͔͚Ͱڠྗͯͩͬͨ͘͠͞օ͞Μ͋Γ͕ ͱ͏͍͟͝·ͨ͠ • ಛʹ @saito @takamoto @hosokoshi @matsuu ...
• ͬͱݕࡧྗ͕ߴ͚ΕҰൃͰͨͲΓண͍͔ͨ͠Εͳ͍ • http://bugs.mysql.com/bug.php?id=67352 • ͱ͍͑ MySQL ʹͪΐͬͱৄ͘͠ͳΕͯΑ͔ͬͨ YOSHIKAWA Ryota hbstyle-2014-12-11 20