SlideShare a Scribd company logo
Submit Search
Upload
Login
Signup
第一回MongoDBソースコードリーディング
Report
nobu_k
Follow
Jun. 28, 2011
•
0 likes
•
1,208 views
1
of
32
第一回MongoDBソースコードリーディング
Jun. 28, 2011
•
0 likes
•
1,208 views
Download Now
Download to read offline
Report
Technology
nobu_k
Follow
Recommended
Nginx-lua
Дэв Тим Афс
2K views
•
21 slides
openstack源码分析(1)
cannium
1.3K views
•
12 slides
Comets notes
Ilija Dukovski
119 views
•
11 slides
Gogo shell
jwausle
216 views
•
7 slides
Page compression. PGCON_2016
Anastasia Lubennikova
316 views
•
11 slides
Vidoop CouchDB Talk
Chris Anderson
658 views
•
38 slides
More Related Content
What's hot
Clojure + MongoDB on Heroku
Naoyuki Kakuda
1.8K views
•
49 slides
Redis
peter_shen
351 views
•
12 slides
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
Woonsan Ko
910 views
•
46 slides
Владимир Мигуро "Дао Node.js"
EPAM Systems
1.1K views
•
18 slides
Mongodb
Gagan Gowda
952 views
•
29 slides
Php 7.x 8.0 and hhvm and
Pierre Joye
424 views
•
59 slides
What's hot
(19)
Clojure + MongoDB on Heroku
Naoyuki Kakuda
•
1.8K views
Redis
peter_shen
•
351 views
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
Woonsan Ko
•
910 views
Владимир Мигуро "Дао Node.js"
EPAM Systems
•
1.1K views
Mongodb
Gagan Gowda
•
952 views
Php 7.x 8.0 and hhvm and
Pierre Joye
•
424 views
NoSQL Injections in Node.js - The case of MongoDB
Sqreen
•
54.5K views
37562259 top-consuming-process
skumner
•
159 views
Extending php (7), the basics
Pierre Joye
•
2.1K views
Security Challenges in Node.js
Websecurify
•
3.3K views
Sample file processing
Issay Meii
•
609 views
PyCon KR 2019 sprint - RustPython by example
YunWon Jeong
•
189 views
Jk rubyslava 25
Jozef Képesi
•
2.7K views
PuppetDB, Puppet Explorer and puppetdbquery
Puppet
•
3.6K views
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Hiroki Mizuno
•
2.7K views
Fast and cost effective geospatial analysis pipeline with AWS lambda
Mila Frerichs
•
102 views
The Art of Command Line (2021)
Kenta Yamamoto
•
132 views
Docker tips & tricks
Dharmit Shah
•
511 views
Etcd terraform by Alex Somesan
Maarten van der Hoef
•
528 views
Similar to 第一回MongoDBソースコードリーディング
MongoDB: a gentle, friendly overview
Antonio Pintus
2.3K views
•
29 slides
Blocks & GCD
rsebbe
2.4K views
•
32 slides
Full metal mongo
Israel Gutiérrez
49.3K views
•
82 slides
MongoDB: Optimising for Performance, Scale & Analytics
Server Density
555 views
•
96 slides
MongoDB at GUL
Israel Gutiérrez
423 views
•
39 slides
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
2.1K views
•
78 slides
Similar to 第一回MongoDBソースコードリーディング
(20)
MongoDB: a gentle, friendly overview
Antonio Pintus
•
2.3K views
Blocks & GCD
rsebbe
•
2.4K views
Full metal mongo
Israel Gutiérrez
•
49.3K views
MongoDB: Optimising for Performance, Scale & Analytics
Server Density
•
555 views
MongoDB at GUL
Israel Gutiérrez
•
423 views
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
•
2.1K views
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
MongoDB
•
602 views
How to use MongoDB with CakePHP
ichikaway
•
16.5K views
Latinoware
kchodorow
•
558 views
Kyotoproducts
Mikio Hirabayashi
•
88.7K views
Rails with mongodb
Kosuke Matsuda
•
1.5K views
Mongodb intro
christkv
•
4.1K views
Functional Hostnames and Why they are Bad
Puppet
•
15.5K views
Take advantage of C++ from Python
Yung-Yu Chen
•
2.2K views
Backup, Restore, and Disaster Recovery
MongoDB
•
3.6K views
Backup, Restore, and Disaster Recovery
MongoDB
•
1.2K views
MongoDB Munich 2012: MongoDB for official documents in Bavaria
MongoDB
•
924 views
Kiosk / PHP
Basuke Suzuki
•
1.4K views
Replacing Oracle with MongoDB for a templating application at the Bavarian go...
Comsysto Reply GmbH
•
2K views
Using MongoDB and Python
Mike Bright
•
1.5K views
More from nobu_k
Elasticsearchと機械学習を実際に連携させる
nobu_k
30K views
•
40 slides
機械学習を利用したちょっとリッチな検索
nobu_k
16.6K views
•
33 slides
4th PFI System reading
nobu_k
1.7K views
•
16 slides
Goraft and InfluxDB
nobu_k
10.4K views
•
22 slides
Transactional Information Systems入門
nobu_k
3.7K views
•
54 slides
Riak Source Code Reading #2: Erlang Client
nobu_k
1.3K views
•
25 slides
More from nobu_k
(8)
Elasticsearchと機械学習を実際に連携させる
nobu_k
•
30K views
機械学習を利用したちょっとリッチな検索
nobu_k
•
16.6K views
4th PFI System reading
nobu_k
•
1.7K views
Goraft and InfluxDB
nobu_k
•
10.4K views
Transactional Information Systems入門
nobu_k
•
3.7K views
Riak Source Code Reading #2: Erlang Client
nobu_k
•
1.3K views
Paxos
nobu_k
•
2.7K views
Suffix Array@Solr勉強会
nobu_k
•
4K views
Recently uploaded
Advancing Equity and Inclusion for Deaf Students in Higher Education
3Play Media
141 views
•
24 slides
Improving Employee Experiences on Cisco RoomOS Devices, Webex, and Microsoft ...
ThousandEyes
60 views
•
25 slides
Accelerating Data Science through Feature Platform, Transformers, and GenAI
FeatureByte
133 views
•
46 slides
Netwitness RT - Don’t scratch that patch.pptx
Stefano Maccaglia
89 views
•
24 slides
How to Manage Your Offshore Software Development Team Efficiently
Capital Numbers
28 views
•
15 slides
Nymity Framework: Privacy & Data Protection Update in 7 States
TrustArc
117 views
•
22 slides
Recently uploaded
(20)
Advancing Equity and Inclusion for Deaf Students in Higher Education
3Play Media
•
141 views
Improving Employee Experiences on Cisco RoomOS Devices, Webex, and Microsoft ...
ThousandEyes
•
60 views
Accelerating Data Science through Feature Platform, Transformers, and GenAI
FeatureByte
•
133 views
Netwitness RT - Don’t scratch that patch.pptx
Stefano Maccaglia
•
89 views
How to Manage Your Offshore Software Development Team Efficiently
Capital Numbers
•
28 views
Nymity Framework: Privacy & Data Protection Update in 7 States
TrustArc
•
117 views
2023 Ivanti September Patch Tuesday
Ivanti
•
97 views
The Ultimate Administrator’s Guide to HCL Nomad Web
panagenda
•
50 views
Die ultimative Anleitung für HCL Nomad Web Administratoren
panagenda
•
57 views
Webinar: Discover the Power of SpiraTeam - A Jira Alternative To Revolutioniz...
Inflectra
•
32 views
How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...
CILIP MDG
•
30 views
Industry 4.0.pdf
Tery Lockitski
•
36 views
Easy Salesforce CI/CD with Open Source Only - Dreamforce 23
NicolasVuillamy1
•
155 views
Framing Few Shot Knowledge Graph Completion with Large Language Models
MODUL Technology GmbH
•
25 views
Metadata & Discovery Group Conference 2023 - Day 2
CILIP MDG
•
12 views
BuilderAI Proposal_Malesniak
Michael Lesniak
•
84 views
Metadata & Discovery Group Conference 2023 - Day 1 Programme
CILIP MDG
•
23 views
Swiss Re Reinsurance Solutions - Automated Claims Experience – Insurer Innova...
The Digital Insurer
•
29 views
Announcing InfluxDB Clustered
InfluxData
•
51 views
Enterprise Application and Data Protection on AWS with Amazon FSx for NetApp ...
LilyJang3
•
17 views
第一回MongoDBソースコードリーディング
1.
MongoDB 2011/6/28
2.
•
@nobu_k • Preferred Infrastructure (PFI) • Sedue • Sedue MongoDB(1.6) • CT○ • http://slidesha.re/hl8PyL • MongoDB as Search Engine Repository
3.
• oplog •
4.
• MongoDB
• https://github.com/mongodb/mongo/ commits/master/ • 2011/6/26 •2 • pull
5.
oplog •
6.
•
2 • createOplog • logOp • db/oplog[h,cpp] •
7.
createOplog • oplog •
8.
createOplog void createOplog() {
> use local dblock lk; // DB switched to db local > show collections // DB. me const char * ns = "local.oplog.$main"; oplog.$main pair.sync slaves sources system.indexes bool rs = !cmdLine._replSet.empty(); if( rs ) ns = rsoplog; // "local.oplog.rs"; // in db/repl/rs_optime.h NS
9.
oplog Client::Context ctx(ns);
// NS NamespaceDetails * nsd = nsdetails( ns ); if ( nsd ) { // oplog ... ... ... ... }
10.
• oplog • ReplicaSet
•
11.
oplog •
oplog • 1. oplog 2. BSON NS • BSON!! 3. oplog
12.
•
• Mac • oplog capped collection
13.
createOplog •
• db/repl.cpp • db/repl/rs_initialsync.cpp • db/repl/rs_initiate.cpp • ReplicaSet •
14.
•
• dblock • CmdLine • Context • DBDirectClient • NamespaceDetails, nsdetails •
15.
dblock •
DB • db/concurrency.h • Deprecated • writelock • dbMutex • scoped_lock • RAII
16.
CmdLine •
• db/cmdline.[h, cpp] • boost::program_options • extern 2 • db/db.cpp // • client/clientOnly.cpp //
17.
Client::Context •
• NS • Client • db/client.[h,cpp] • RAII • DB
18.
currentClient •
Client • Thread Local • boost::thread_specific_ptr<Client> • cc(), currenctClient, Context::getClient • DB
19.
DBDirectClient • •
DBClientInterface (client/dbclient.h) • DBConnector (client/dbclient.h) • DBClientWithCommands : public DBClientInterface • DBClientBase : public DBClientWithCommands, public DBConnector • DBDirectClient : public DBClientBase • findOne • c.findOne→DBClientInterface::findOne→DBClientInterface::findN→(virtual )DBDirectClient::query→DBClientBase::query • DBClientCursor •
20.
NamespaceDetails • .ns
(1 ) • • Database • MongoDataFile • Record •
21.
nsdetails •
Context NamespaceDetails • db/pdfile.h • cc().database()->namespaceIndex->details • NamespaceIndex • map<string, NamespaceDetails> •
22.
logOp • •
23.
oplog {
ts: • oplog BSON op: ns: NS • o: BSON o2: } • o2
24.
•
i : insert • u : update • d : delete • c : db cmd? userCreateNS? • db : declares presence of a database • n : no op ( ) • • keep alive •
25.
logOp _logOp void logOp(const char
*opstr, const char *ns, const BSONObj& obj, BSONObj *patt, bool *b) { if ( replSettings.master ) { _logOp(opstr, ns, 0, obj, patt, b); } logOpForSharding( opstr , ns , obj , patt ); }
26.
_logOp •
• _logOpOld • _logOpRS • etc? •
27.
_logOpOld • • Record theDataFileMgr
• fast_oplog_insert!! • ( mmap )
28.
append_O_Obj • partial ”o”+ •
BSONBuilder • • repeatedly ed
29.
_logOpRS •
30.
logOp • • grep it!
31.
• applyOperation_inlock • pretouch
32.
We are hiring
! • • • • • • • • OSS • • (´ ω `)
Editor's Notes
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n