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
160
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
3.4k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.2k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
9
2.4k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
8.5k
「信頼性」を保ちつつ大規模サービスをリニューアルする / 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.2k
A survey of anomaly detection methodologies for web system
rrreeeyyy
5
1.2k
Other Decks in Technology
See All in Technology
Engineer Career Talk
lycorp_recruit_jp
0
150
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
複雑なState管理からの脱却
sansantech
PRO
1
140
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
590
Evangelismo técnico: ¿qué, cómo y por qué?
trishagee
0
360
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
Can We Measure Developer Productivity?
ewolff
1
150
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing for humans not robots
tammielis
250
25k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Why Our Code Smells
bkeepers
PRO
334
57k
Typedesign – Prime Four
hannesfritz
40
2.4k
Into the Great Unknown - MozCon
thekraken
32
1.5k
The Invisible Side of Design
smashingmag
298
50k
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