NamenodeFGL.html 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <!--
  3. | Generated by Apache Maven Doxia at 2025-05-02
  4. | Rendered using Apache Maven Stylus Skin 1.5
  5. -->
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <title>Apache Hadoop 3.5.0-SNAPSHOT &#x2013; HDFS Namenode Fine-grained Locking</title>
  9. <style type="text/css" media="all">
  10. @import url("./css/maven-base.css");
  11. @import url("./css/maven-theme.css");
  12. @import url("./css/site.css");
  13. </style>
  14. <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
  15. <meta name="Date-Revision-yyyymmdd" content="20250502" />
  16. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  17. </head>
  18. <body class="composite">
  19. <div id="banner">
  20. <a href="http://hadoop.apache.org/" id="bannerLeft">
  21. <img src="http://hadoop.apache.org/images/hadoop-logo.jpg" alt="" />
  22. </a>
  23. <a href="http://www.apache.org/" id="bannerRight">
  24. <img src="http://www.apache.org/images/asf_logo_wide.png" alt="" />
  25. </a>
  26. <div class="clear">
  27. <hr/>
  28. </div>
  29. </div>
  30. <div id="breadcrumbs">
  31. <div class="xright"> <a href="http://wiki.apache.org/hadoop" class="externalLink">Wiki</a>
  32. |
  33. <a href="https://gitbox.apache.org/repos/asf/hadoop.git" class="externalLink">git</a>
  34. |
  35. <a href="http://hadoop.apache.org/" class="externalLink">Apache Hadoop</a>
  36. &nbsp;| Last Published: 2025-05-02
  37. &nbsp;| Version: 3.5.0-SNAPSHOT
  38. </div>
  39. <div class="clear">
  40. <hr/>
  41. </div>
  42. </div>
  43. <div id="leftColumn">
  44. <div id="navcolumn">
  45. <h5>General</h5>
  46. <ul>
  47. <li class="none">
  48. <a href="../../index.html">Overview</a>
  49. </li>
  50. <li class="none">
  51. <a href="../../hadoop-project-dist/hadoop-common/SingleCluster.html">Single Node Setup</a>
  52. </li>
  53. <li class="none">
  54. <a href="../../hadoop-project-dist/hadoop-common/ClusterSetup.html">Cluster Setup</a>
  55. </li>
  56. <li class="none">
  57. <a href="../../hadoop-project-dist/hadoop-common/CommandsManual.html">Commands Reference</a>
  58. </li>
  59. <li class="none">
  60. <a href="../../hadoop-project-dist/hadoop-common/FileSystemShell.html">FileSystem Shell</a>
  61. </li>
  62. <li class="none">
  63. <a href="../../hadoop-project-dist/hadoop-common/Compatibility.html">Compatibility Specification</a>
  64. </li>
  65. <li class="none">
  66. <a href="../../hadoop-project-dist/hadoop-common/DownstreamDev.html">Downstream Developer's Guide</a>
  67. </li>
  68. <li class="none">
  69. <a href="../../hadoop-project-dist/hadoop-common/AdminCompatibilityGuide.html">Admin Compatibility Guide</a>
  70. </li>
  71. <li class="none">
  72. <a href="../../hadoop-project-dist/hadoop-common/InterfaceClassification.html">Interface Classification</a>
  73. </li>
  74. <li class="none">
  75. <a href="../../hadoop-project-dist/hadoop-common/filesystem/index.html">FileSystem Specification</a>
  76. </li>
  77. </ul>
  78. <h5>Common</h5>
  79. <ul>
  80. <li class="none">
  81. <a href="../../hadoop-project-dist/hadoop-common/CLIMiniCluster.html">CLI Mini Cluster</a>
  82. </li>
  83. <li class="none">
  84. <a href="../../hadoop-project-dist/hadoop-common/FairCallQueue.html">Fair Call Queue</a>
  85. </li>
  86. <li class="none">
  87. <a href="../../hadoop-project-dist/hadoop-common/NativeLibraries.html">Native Libraries</a>
  88. </li>
  89. <li class="none">
  90. <a href="../../hadoop-project-dist/hadoop-common/Superusers.html">Proxy User</a>
  91. </li>
  92. <li class="none">
  93. <a href="../../hadoop-project-dist/hadoop-common/RackAwareness.html">Rack Awareness</a>
  94. </li>
  95. <li class="none">
  96. <a href="../../hadoop-project-dist/hadoop-common/SecureMode.html">Secure Mode</a>
  97. </li>
  98. <li class="none">
  99. <a href="../../hadoop-project-dist/hadoop-common/ServiceLevelAuth.html">Service Level Authorization</a>
  100. </li>
  101. <li class="none">
  102. <a href="../../hadoop-project-dist/hadoop-common/HttpAuthentication.html">HTTP Authentication</a>
  103. </li>
  104. <li class="none">
  105. <a href="../../hadoop-project-dist/hadoop-common/CredentialProviderAPI.html">Credential Provider API</a>
  106. </li>
  107. <li class="none">
  108. <a href="../../hadoop-kms/index.html">Hadoop KMS</a>
  109. </li>
  110. <li class="none">
  111. <a href="../../hadoop-project-dist/hadoop-common/Tracing.html">Tracing</a>
  112. </li>
  113. <li class="none">
  114. <a href="../../hadoop-project-dist/hadoop-common/UnixShellGuide.html">Unix Shell Guide</a>
  115. </li>
  116. <li class="none">
  117. <a href="../../hadoop-project-dist/hadoop-common/registry/index.html">Registry</a>
  118. </li>
  119. <li class="none">
  120. <a href="../../hadoop-project-dist/hadoop-common/AsyncProfilerServlet.html">Async Profiler</a>
  121. </li>
  122. </ul>
  123. <h5>HDFS</h5>
  124. <ul>
  125. <li class="none">
  126. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDesign.html">Architecture</a>
  127. </li>
  128. <li class="none">
  129. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html">User Guide</a>
  130. </li>
  131. <li class="none">
  132. <a href="../../hadoop-project-dist/hadoop-hdfs/HDFSCommands.html">Commands Reference</a>
  133. </li>
  134. <li class="none">
  135. <a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html">NameNode HA With QJM</a>
  136. </li>
  137. <li class="none">
  138. <a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithNFS.html">NameNode HA With NFS</a>
  139. </li>
  140. <li class="none">
  141. <a href="../../hadoop-project-dist/hadoop-hdfs/ObserverNameNode.html">Observer NameNode</a>
  142. </li>
  143. <li class="none">
  144. <a href="../../hadoop-project-dist/hadoop-hdfs/Federation.html">Federation</a>
  145. </li>
  146. <li class="none">
  147. <a href="../../hadoop-project-dist/hadoop-hdfs/ViewFs.html">ViewFs</a>
  148. </li>
  149. <li class="none">
  150. <a href="../../hadoop-project-dist/hadoop-hdfs/ViewFsOverloadScheme.html">ViewFsOverloadScheme</a>
  151. </li>
  152. <li class="none">
  153. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html">Snapshots</a>
  154. </li>
  155. <li class="none">
  156. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsEditsViewer.html">Edits Viewer</a>
  157. </li>
  158. <li class="none">
  159. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsImageViewer.html">Image Viewer</a>
  160. </li>
  161. <li class="none">
  162. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html">Permissions and HDFS</a>
  163. </li>
  164. <li class="none">
  165. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html">Quotas and HDFS</a>
  166. </li>
  167. <li class="none">
  168. <a href="../../hadoop-project-dist/hadoop-hdfs/LibHdfs.html">libhdfs (C API)</a>
  169. </li>
  170. <li class="none">
  171. <a href="../../hadoop-project-dist/hadoop-hdfs/WebHDFS.html">WebHDFS (REST API)</a>
  172. </li>
  173. <li class="none">
  174. <a href="../../hadoop-hdfs-httpfs/index.html">HttpFS</a>
  175. </li>
  176. <li class="none">
  177. <a href="../../hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html">Short Circuit Local Reads</a>
  178. </li>
  179. <li class="none">
  180. <a href="../../hadoop-project-dist/hadoop-hdfs/CentralizedCacheManagement.html">Centralized Cache Management</a>
  181. </li>
  182. <li class="none">
  183. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsNfsGateway.html">NFS Gateway</a>
  184. </li>
  185. <li class="none">
  186. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsRollingUpgrade.html">Rolling Upgrade</a>
  187. </li>
  188. <li class="none">
  189. <a href="../../hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html">Extended Attributes</a>
  190. </li>
  191. <li class="none">
  192. <a href="../../hadoop-project-dist/hadoop-hdfs/TransparentEncryption.html">Transparent Encryption</a>
  193. </li>
  194. <li class="none">
  195. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsMultihoming.html">Multihoming</a>
  196. </li>
  197. <li class="none">
  198. <a href="../../hadoop-project-dist/hadoop-hdfs/ArchivalStorage.html">Storage Policies</a>
  199. </li>
  200. <li class="none">
  201. <a href="../../hadoop-project-dist/hadoop-hdfs/MemoryStorage.html">Memory Storage Support</a>
  202. </li>
  203. <li class="none">
  204. <a href="../../hadoop-project-dist/hadoop-hdfs/SLGUserGuide.html">Synthetic Load Generator</a>
  205. </li>
  206. <li class="none">
  207. <a href="../../hadoop-project-dist/hadoop-hdfs/HDFSErasureCoding.html">Erasure Coding</a>
  208. </li>
  209. <li class="none">
  210. <a href="../../hadoop-project-dist/hadoop-hdfs/HDFSDiskbalancer.html">Disk Balancer</a>
  211. </li>
  212. <li class="none">
  213. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUpgradeDomain.html">Upgrade Domain</a>
  214. </li>
  215. <li class="none">
  216. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDataNodeAdminGuide.html">DataNode Admin</a>
  217. </li>
  218. <li class="none">
  219. <a href="../../hadoop-project-dist/hadoop-hdfs-rbf/HDFSRouterFederation.html">Router Federation</a>
  220. </li>
  221. <li class="none">
  222. <a href="../../hadoop-project-dist/hadoop-hdfs/HdfsProvidedStorage.html">Provided Storage</a>
  223. </li>
  224. </ul>
  225. <h5>MapReduce</h5>
  226. <ul>
  227. <li class="none">
  228. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html">Tutorial</a>
  229. </li>
  230. <li class="none">
  231. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredCommands.html">Commands Reference</a>
  232. </li>
  233. <li class="none">
  234. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibility with 1.x</a>
  235. </li>
  236. <li class="none">
  237. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/EncryptedShuffle.html">Encrypted Shuffle</a>
  238. </li>
  239. <li class="none">
  240. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/PluggableShuffleAndPluggableSort.html">Pluggable Shuffle/Sort</a>
  241. </li>
  242. <li class="none">
  243. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistributedCacheDeploy.html">Distributed Cache Deploy</a>
  244. </li>
  245. <li class="none">
  246. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/SharedCacheSupport.html">Support for YARN Shared Cache</a>
  247. </li>
  248. </ul>
  249. <h5>MapReduce REST APIs</h5>
  250. <ul>
  251. <li class="none">
  252. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredAppMasterRest.html">MR Application Master</a>
  253. </li>
  254. <li class="none">
  255. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-hs/HistoryServerRest.html">MR History Server</a>
  256. </li>
  257. </ul>
  258. <h5>YARN</h5>
  259. <ul>
  260. <li class="none">
  261. <a href="../../hadoop-yarn/hadoop-yarn-site/YARN.html">Architecture</a>
  262. </li>
  263. <li class="none">
  264. <a href="../../hadoop-yarn/hadoop-yarn-site/YarnCommands.html">Commands Reference</a>
  265. </li>
  266. <li class="none">
  267. <a href="../../hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html">Capacity Scheduler</a>
  268. </li>
  269. <li class="none">
  270. <a href="../../hadoop-yarn/hadoop-yarn-site/FairScheduler.html">Fair Scheduler</a>
  271. </li>
  272. <li class="none">
  273. <a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRestart.html">ResourceManager Restart</a>
  274. </li>
  275. <li class="none">
  276. <a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html">ResourceManager HA</a>
  277. </li>
  278. <li class="none">
  279. <a href="../../hadoop-yarn/hadoop-yarn-site/ResourceModel.html">Resource Model</a>
  280. </li>
  281. <li class="none">
  282. <a href="../../hadoop-yarn/hadoop-yarn-site/NodeLabel.html">Node Labels</a>
  283. </li>
  284. <li class="none">
  285. <a href="../../hadoop-yarn/hadoop-yarn-site/NodeAttributes.html">Node Attributes</a>
  286. </li>
  287. <li class="none">
  288. <a href="../../hadoop-yarn/hadoop-yarn-site/WebApplicationProxy.html">Web Application Proxy</a>
  289. </li>
  290. <li class="none">
  291. <a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html">Timeline Server</a>
  292. </li>
  293. <li class="none">
  294. <a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html">Timeline Service V.2</a>
  295. </li>
  296. <li class="none">
  297. <a href="../../hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html">Writing YARN Applications</a>
  298. </li>
  299. <li class="none">
  300. <a href="../../hadoop-yarn/hadoop-yarn-site/YarnApplicationSecurity.html">YARN Application Security</a>
  301. </li>
  302. <li class="none">
  303. <a href="../../hadoop-yarn/hadoop-yarn-site/NodeManager.html">NodeManager</a>
  304. </li>
  305. <li class="none">
  306. <a href="../../hadoop-yarn/hadoop-yarn-site/DockerContainers.html">Running Applications in Docker Containers</a>
  307. </li>
  308. <li class="none">
  309. <a href="../../hadoop-yarn/hadoop-yarn-site/RuncContainers.html">Running Applications in runC Containers</a>
  310. </li>
  311. <li class="none">
  312. <a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerCgroups.html">Using CGroups</a>
  313. </li>
  314. <li class="none">
  315. <a href="../../hadoop-yarn/hadoop-yarn-site/SecureContainer.html">Secure Containers</a>
  316. </li>
  317. <li class="none">
  318. <a href="../../hadoop-yarn/hadoop-yarn-site/ReservationSystem.html">Reservation System</a>
  319. </li>
  320. <li class="none">
  321. <a href="../../hadoop-yarn/hadoop-yarn-site/GracefulDecommission.html">Graceful Decommission</a>
  322. </li>
  323. <li class="none">
  324. <a href="../../hadoop-yarn/hadoop-yarn-site/OpportunisticContainers.html">Opportunistic Containers</a>
  325. </li>
  326. <li class="none">
  327. <a href="../../hadoop-yarn/hadoop-yarn-site/Federation.html">YARN Federation</a>
  328. </li>
  329. <li class="none">
  330. <a href="../../hadoop-yarn/hadoop-yarn-site/SharedCache.html">Shared Cache</a>
  331. </li>
  332. <li class="none">
  333. <a href="../../hadoop-yarn/hadoop-yarn-site/UsingGpus.html">Using GPU</a>
  334. </li>
  335. <li class="none">
  336. <a href="../../hadoop-yarn/hadoop-yarn-site/UsingFPGA.html">Using FPGA</a>
  337. </li>
  338. <li class="none">
  339. <a href="../../hadoop-yarn/hadoop-yarn-site/PlacementConstraints.html">Placement Constraints</a>
  340. </li>
  341. <li class="none">
  342. <a href="../../hadoop-yarn/hadoop-yarn-site/YarnUI2.html">YARN UI2</a>
  343. </li>
  344. </ul>
  345. <h5>YARN REST APIs</h5>
  346. <ul>
  347. <li class="none">
  348. <a href="../../hadoop-yarn/hadoop-yarn-site/WebServicesIntro.html">Introduction</a>
  349. </li>
  350. <li class="none">
  351. <a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html">Resource Manager</a>
  352. </li>
  353. <li class="none">
  354. <a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerRest.html">Node Manager</a>
  355. </li>
  356. <li class="none">
  357. <a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html#Timeline_Server_REST_API_v1">Timeline Server</a>
  358. </li>
  359. <li class="none">
  360. <a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html#Timeline_Service_v.2_REST_API">Timeline Service V.2</a>
  361. </li>
  362. </ul>
  363. <h5>YARN Service</h5>
  364. <ul>
  365. <li class="none">
  366. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Overview.html">Overview</a>
  367. </li>
  368. <li class="none">
  369. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/QuickStart.html">QuickStart</a>
  370. </li>
  371. <li class="none">
  372. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Concepts.html">Concepts</a>
  373. </li>
  374. <li class="none">
  375. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/YarnServiceAPI.html">Yarn Service API</a>
  376. </li>
  377. <li class="none">
  378. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/ServiceDiscovery.html">Service Discovery</a>
  379. </li>
  380. <li class="none">
  381. <a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/SystemServices.html">System Services</a>
  382. </li>
  383. </ul>
  384. <h5>Hadoop Compatible File Systems</h5>
  385. <ul>
  386. <li class="none">
  387. <a href="../../hadoop-aliyun/tools/hadoop-aliyun/index.html">Aliyun OSS</a>
  388. </li>
  389. <li class="none">
  390. <a href="../../hadoop-aws/tools/hadoop-aws/index.html">Amazon S3</a>
  391. </li>
  392. <li class="none">
  393. <a href="../../hadoop-azure/index.html">Azure Blob Storage</a>
  394. </li>
  395. <li class="none">
  396. <a href="../../hadoop-azure-datalake/index.html">Azure Data Lake Storage</a>
  397. </li>
  398. <li class="none">
  399. <a href="../../hadoop-cos/cloud-storage/index.html">Tencent COS</a>
  400. </li>
  401. <li class="none">
  402. <a href="../../hadoop-huaweicloud/index.html">Huaweicloud OBS</a>
  403. </li>
  404. <li class="none">
  405. <a href="../../hadoop-tos/cloud-storage/index.html">VolcanoEngine TOS</a>
  406. </li>
  407. </ul>
  408. <h5>Auth</h5>
  409. <ul>
  410. <li class="none">
  411. <a href="../../hadoop-auth/index.html">Overview</a>
  412. </li>
  413. <li class="none">
  414. <a href="../../hadoop-auth/Examples.html">Examples</a>
  415. </li>
  416. <li class="none">
  417. <a href="../../hadoop-auth/Configuration.html">Configuration</a>
  418. </li>
  419. <li class="none">
  420. <a href="../../hadoop-auth/BuildingIt.html">Building</a>
  421. </li>
  422. </ul>
  423. <h5>Tools</h5>
  424. <ul>
  425. <li class="none">
  426. <a href="../../hadoop-streaming/HadoopStreaming.html">Hadoop Streaming</a>
  427. </li>
  428. <li class="none">
  429. <a href="../../hadoop-archives/HadoopArchives.html">Hadoop Archives</a>
  430. </li>
  431. <li class="none">
  432. <a href="../../hadoop-archive-logs/HadoopArchiveLogs.html">Hadoop Archive Logs</a>
  433. </li>
  434. <li class="none">
  435. <a href="../../hadoop-distcp/DistCp.html">DistCp</a>
  436. </li>
  437. <li class="none">
  438. <a href="../../hadoop-federation-balance/HDFSFederationBalance.html">HDFS Federation Balance</a>
  439. </li>
  440. <li class="none">
  441. <a href="../../hadoop-gridmix/GridMix.html">GridMix</a>
  442. </li>
  443. <li class="none">
  444. <a href="../../hadoop-rumen/Rumen.html">Rumen</a>
  445. </li>
  446. <li class="none">
  447. <a href="../../hadoop-resourceestimator/ResourceEstimator.html">Resource Estimator Service</a>
  448. </li>
  449. <li class="none">
  450. <a href="../../hadoop-sls/SchedulerLoadSimulator.html">Scheduler Load Simulator</a>
  451. </li>
  452. <li class="none">
  453. <a href="../../hadoop-project-dist/hadoop-common/Benchmarking.html">Hadoop Benchmarking</a>
  454. </li>
  455. <li class="none">
  456. <a href="../../hadoop-dynamometer/Dynamometer.html">Dynamometer</a>
  457. </li>
  458. </ul>
  459. <h5>Reference</h5>
  460. <ul>
  461. <li class="none">
  462. <a href="../../hadoop-project-dist/hadoop-common/release/">Changelog and Release Notes</a>
  463. </li>
  464. <li class="none">
  465. <a href="../../api/index.html">Java API docs</a>
  466. </li>
  467. <li class="none">
  468. <a href="../../hadoop-project-dist/hadoop-common/UnixShellAPI.html">Unix Shell API</a>
  469. </li>
  470. <li class="none">
  471. <a href="../../hadoop-project-dist/hadoop-common/Metrics.html">Metrics</a>
  472. </li>
  473. </ul>
  474. <h5>Configuration</h5>
  475. <ul>
  476. <li class="none">
  477. <a href="../../hadoop-project-dist/hadoop-common/core-default.xml">core-default.xml</a>
  478. </li>
  479. <li class="none">
  480. <a href="../../hadoop-project-dist/hadoop-hdfs/hdfs-default.xml">hdfs-default.xml</a>
  481. </li>
  482. <li class="none">
  483. <a href="../../hadoop-project-dist/hadoop-hdfs-rbf/hdfs-rbf-default.xml">hdfs-rbf-default.xml</a>
  484. </li>
  485. <li class="none">
  486. <a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml">mapred-default.xml</a>
  487. </li>
  488. <li class="none">
  489. <a href="../../hadoop-yarn/hadoop-yarn-common/yarn-default.xml">yarn-default.xml</a>
  490. </li>
  491. <li class="none">
  492. <a href="../../hadoop-kms/kms-default.html">kms-default.xml</a>
  493. </li>
  494. <li class="none">
  495. <a href="../../hadoop-hdfs-httpfs/httpfs-default.html">httpfs-default.xml</a>
  496. </li>
  497. <li class="none">
  498. <a href="../../hadoop-project-dist/hadoop-common/DeprecatedProperties.html">Deprecated Properties</a>
  499. </li>
  500. </ul>
  501. <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
  502. <img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
  503. </a>
  504. </div>
  505. </div>
  506. <div id="bodyColumn">
  507. <div id="contentBox">
  508. <!--
  509. Licensed to the Apache Software Foundation (ASF) under one or more
  510. contributor license agreements. See the NOTICE file distributed with
  511. this work for additional information regarding copyright ownership.
  512. The ASF licenses this file to You under the Apache License, Version 2.0
  513. (the "License"); you may not use this file except in compliance with
  514. the License. You may obtain a copy of the License at
  515. http://www.apache.org/licenses/LICENSE-2.0
  516. Unless required by applicable law or agreed to in writing, software
  517. distributed under the License is distributed on an "AS IS" BASIS,
  518. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  519. See the License for the specific language governing permissions and
  520. limitations under the License.
  521. -->
  522. <h1>HDFS Namenode Fine-grained Locking</h1>
  523. <ul>
  524. <li><a href="#Overview">Overview</a></li>
  525. <li><a href="#Design">Design</a>
  526. <ul>
  527. <li><a href="#RPC_Categorization">RPC Categorization</a></li>
  528. <li><a href="#Full_Path_Lock">Full Path Lock</a></li>
  529. <li><a href="#INodeFile_Lock">INodeFile Lock</a></li>
  530. <li><a href="#DN_Lock">DN Lock</a></li>
  531. <li><a href="#Global_Lock">Global Lock</a></li>
  532. <li><a href="#Lock_Order">Lock Order</a></li>
  533. <li><a href="#Lock_Pools">Lock Pools</a></li>
  534. <li><a href="#Lock_Modes">Lock Modes</a></li></ul></li>
  535. <li><a href="#Roadmap">Roadmap</a>
  536. <ul>
  537. <li><a href="#a"></a>
  538. <ul>
  539. <li><a href="#Stage_1:_Split_the_global_lock_into_FSLock_and_BMLock">Stage 1: Split the global lock into FSLock and BMLock</a></li>
  540. <li><a href="#Stage_2:_Split_the_global_FSLock">Stage 2: Split the global FSLock</a></li>
  541. <li><a href="#Stage_3:_Split_the_global_BMLock">Stage 3: Split the global BMLock</a></li></ul></li></ul></li>
  542. <li><a href="#Configuration">Configuration</a></li>
  543. <li><a href="#Adding_RPC">Adding RPC</a></li></ul>
  544. <section>
  545. <h2><a name="Overview"></a>Overview</h2>
  546. <p>HDFS relies on a single master, the Namenode (NN), as its metadata center. From an architectural point of view, a few elements make NN the bottleneck of an HDFS cluster: * NN keeps the entire namespace in memory (directory tree, blocks, Datanode related info, etc.) * Read requests (<code>getListing</code>, <code>getFileInfo</code>, <code>getBlockLocations</code>) are served from memory. Write requests (<code>mkdir</code>, <code>create</code>, <code>addBlock</code>, <code>complete</code>) update the memory state and write a journal transaction into QJM. Both types of requests need a locking mechanism to ensure data consistency and correctness. * All requests are funneled into NN and have to go through the global FS lock. Each write operation acquires this lock in write mode and holds it until that operation is executed. This lock mode prevents concurrent execution of write operations even if they involve different branches of the directory tree.</p>
  547. <p>NN fine-grained locking (FGL) implementation aims to alleviate this bottleneck by allowing concurrency of disjoint write operations.</p>
  548. <p>JIRA: <a class="externalLink" href="https://issues.apache.org/jira/browse/HDFS-17366">HDFS-17366</a></p></section><section>
  549. <h2><a name="Design"></a>Design</h2>
  550. <p>In theory, fully independent operations can be processed concurrently, such as operations involving different subdirectory trees. As such, NN can split the global lock into the full path lock, just using the full path lock to protect a special subdirectory tree.</p><section>
  551. <h3><a name="RPC_Categorization"></a>RPC Categorization</h3>
  552. <p>Roughly, RPC operations handled by NN can be divided into 8 main categories</p>
  553. <table border="0" class="bodyTable">
  554. <thead>
  555. <tr class="a">
  556. <th> Category </th>
  557. <th> Operations </th></tr>
  558. </thead><tbody>
  559. <tr class="b">
  560. <td> Involving namespace tree </td>
  561. <td> <code>mkdir</code>, <code>create</code> (without overwrite), <code>getFileInfo</code> (without locations), <code>getListing</code> (without locations), <code>setOwner</code>, <code>setPermission</code>, <code>getStoragePolicy</code>, <code>setStoragePolicy</code>, <code>rename</code>, <code>isFileClosed</code>, <code>getFileLinkInfo</code>, <code>setTimes</code>, <code>modifyAclEntries</code>, <code>removeAclEntries</code>, <code>setAcl</code>, <code>getAcl</code>, <code>setXAttr</code>, <code>getXAttrs</code>, <code>listXAttrs</code>, <code>removeXAttr</code>, <code>checkAccess</code>, <code>getErasureCodingPolicy</code>, <code>unsetErasureCodingPolicy</code>, <code>getQuotaUsage</code>, <code>getPreferredBlockSize</code> </td></tr>
  562. <tr class="a">
  563. <td> Involving only blocks </td>
  564. <td> <code>reportBadBlocks</code>, <code>updateBlockForPipeline</code>, <code>updatePipeline</code> </td></tr>
  565. <tr class="b">
  566. <td> Involving only DNs </td>
  567. <td> <code>registerDatanode</code>, <code>setBalancerBandwidth</code>, <code>sendHeartbeat</code> </td></tr>
  568. <tr class="a">
  569. <td> Involving both namespace tree &amp; blocks </td>
  570. <td> <code>getBlockLocation</code>, <code>create</code> (with overwrite), <code>append</code>, <code>setReplication</code>, <code>abandonBlock</code>, <code>addBlock</code>, <code>getAdditionalDatanode</code>, <code>complete</code>, <code>concat</code>, <code>truncate</code>, <code>delete</code>, <code>getListing</code> (with locations), <code>getFileInfo</code> (with locations), <code>recoverLease</code>, <code>listCorruptFileBlocks</code>, <code>fsync</code>, <code>commitBlockSynchronization</code>, <code>RedundancyMonitor</code>, <code>processMisReplicatedBlocks</code> </td></tr>
  571. <tr class="b">
  572. <td> Involving both DNs &amp; blocks </td>
  573. <td> <code>getBlocks</code>, <code>errorReport</code> </td></tr>
  574. <tr class="a">
  575. <td> Involving namespace tree, DNs &amp; blocks </td>
  576. <td> <code>blockReport</code>, <code>blockReceivedAndDeleted</code>, <code>HeartbeatManager</code>, <code>Decommission</code> </td></tr>
  577. <tr class="b">
  578. <td> Requiring locking the entire namespace </td>
  579. <td> <code>rollEditLog</code>, <code>startCommonService</code>, <code>startActiveService</code>, <code>saveNamespace</code>, <code>rollEdits</code>, <code>EditLogTailer</code>, <code>rollingUpgrade</code> </td></tr>
  580. <tr class="a">
  581. <td> Requiring no locking </td>
  582. <td> <code>getServerDefaults</code>, <code>getStats</code> </td></tr>
  583. </tbody>
  584. </table>
  585. <p>For operations involving namespace tree, fully independent operations can be handled by NN concurrently. Almost all of them use the full path as a parameter, e.g. <code>create</code>, <code>mkdirs</code>, <code>getFileInfo</code>, etc. So we can use a full path lock to make them thread-safe.</p>
  586. <p>For operations involving blocks, one block belongs to one and only one <code>INodeFile</code>, so NN can use the namespace tree to make these operations thread-safe.</p>
  587. <p>For operations involving DNs, NN needs a separate DN lock because DNs operate separately from the namespace tree.</p>
  588. <p>For operations requiring the entire namespace locked, the global lock can be used to make these operations thread-safe. In general, these operations have low frequency and thus low impact despite the global locking.</p></section><section>
  589. <h3><a name="Full_Path_Lock"></a>Full Path Lock</h3>
  590. <p>Used to protect operations involving namespace tree.</p>
  591. <p>All of these operations receive a path or INodeID as a parameter and can further be divided into 3 main subcategories: 1. Parameters contain only one path (<code>create</code>, <code>mkdir</code>) 2. Parameters contain multiple paths (<code>rename</code>, <code>concat</code>) 3. Parameters contain INodeID (<code>addBlock</code>, <code>complete</code>)</p>
  592. <p>For type 1, NN acquires a full path lock according to its semantics. Take <code>setPermission(&quot;/a/b/c/f.txt&quot;)</code> for example, the set of locks to acquire are ReadLock(&#x201c;/&#x201d;), ReadLock(&#x201c;a&#x201d;), ReadLock(&#x201c;b&#x201d;), ReadLock(&#x201c;c&#x201d;) and WriteLock(&#x201c;f.txt&#x201d;). Different lock patterns are explained in a later section.</p>
  593. <p>For type 2, NN acquires full path locks in a predefined order, such as the lexicographic order, to avoid deadlocks.</p>
  594. <p>For type 3, NN acquires a full path lock by in the following fashion: - Unsafely obtains full path recursively - Acquires the full path lock according to the lock mode - Rechecks whether the last node of the full path is equal to the INodeID given - If not, that means that the <code>INodeFile</code> might have been renamed or concatenated, need to retry - If the max retry attempts have been reached, throw a <code>RetryException</code> to client to let client retry</p></section><section>
  595. <h3><a name="INodeFile_Lock"></a><code>INodeFile</code> Lock</h3>
  596. <p>Used to protect operations involving blocks.</p>
  597. <p>One block belongs to one and only one <code>INodeFile</code>, so NN can use the INodeFile lock to make operations thread-safe. Normally, there is no need to acquire the full path lock since changing the namespace tree structure does not affect the block.</p>
  598. <p><code>concat</code> might change the <code>INodeFile</code> a block belongs to. Since both block related operations and <code>concat</code> need to acquire the <code>INodeFile</code> write lock, only one of them can be processed at a time.</p></section><section>
  599. <h3><a name="DN_Lock"></a>DN Lock</h3>
  600. <p>Used to protect operations involving DNs.</p>
  601. <p>NN uses a <code>DatanodeDescriptor</code> object to store the information of one DN and uses <code>DatanodeManager</code> to manage all DNs in the memory. <code>DatanodeDescriptor</code> uses <code>DatanodeStorageInfo</code> to store the information of one storage device on one DN.</p>
  602. <p>DNs have nothing to do with the namespace tree, so NN uses a separate DN lock for these operations. Since DNs are independent of one another, NN can assign a lock to each DN.</p></section><section>
  603. <h3><a name="Global_Lock"></a>Global Lock</h3>
  604. <p>Used for operations requiring the entire namespace locked.</p>
  605. <p>There are some operations that need to lock the entire namespace, e.g. safe mode related operations, HA service related, etc. NN uses the global lock to make these operations thread-safe. Outside of these infrequent operations that require the global write lock, all other operations have to acquire the global read lock. The only exception to this rule is JMX operations being allowed to bypass locking entirely to ensure that metrics can be collected regardless of long write lock holding.</p></section><section>
  606. <h3><a name="Lock_Order"></a>Lock Order</h3>
  607. <p>As mentioned above, there are the global lock, DN lock, and full path lock. NN acquires locks in this specific order to avoid deadlocks.</p>
  608. <p>Locks are to be acquired in this order: - Global &gt; DN &gt; Full path - Global &gt; DN &gt; Last <code>INodeFile</code></p>
  609. <p>Possible lock combinations are as follows: - Global write lock - Global read lock &gt; Full path lock - Global read lock &gt; DN read/write lock - Global read lock &gt; DN read/write lock &gt; Read/Write lock of last <code>INodeFile</code> - Global read lock &gt; DN read/write lock &gt; Full path lock</p></section><section>
  610. <h3><a name="Lock_Pools"></a>Lock Pools</h3>
  611. <p>NN allocates locks as needed to the INodes used by active threads, and deletes them after the locks are no longer in use. Locks for commonly accessed <code>INode</code>s like the root are cached.</p>
  612. <p>NN uses an <code>INodeLockPool</code> to manage these locks. The lock pool: - Returns a closeable lock for an INode based on the lock type, - Removes this lock if it is no longer used by any threads.</p>
  613. <p>Similar to <code>INodeLockPool</code>, a <code>DNLockPool</code> is used to manage the locks for DNs. Unlike <code>INodeLockPool</code>, <code>DNLockPool</code> keeps all locks in memory due to the comparatively lower number of locks.</p></section><section>
  614. <h3><a name="Lock_Modes"></a>Lock Modes</h3>
  615. <p>Operations related to namespace tree have different semantics and may involve the modification or access of different INodes, for example: <code>getBlockLocation</code> only accesses the last iNodeFile, <code>delete</code> modifies both the parent and the last INode, <code>mkdir</code> may modify multiple ancestor INodes.</p>
  616. <p>Four lock modes (plus no locking): - LOCK_READ - This lock mode acquires the read locks for all INodes down the path. - Example operations: <code>getBlockLocation</code>, <code>getFileInfo</code>. - LOCK_WRITE - This lock mode acquires the write lock for the last INode and the read locks for all ancestor INodes in the full path. - Example operations: <code>setPermission</code>, <code>setReplication</code>. - LOCK_PARENT - This lock mode acquires the write lock for the last two INodes and the read locks for all remaining ancestor INodes in the full path. - Example operations: <code>rename</code>, <code>delete</code>, <code>create</code> (when the parent directory exists). - LOCK_ANCESTOR - This lock mode acquires the write lock for the last existing INode and the read locks for all remaining ancestor INodes in the full path. - Example operations: <code>mkdir</code>, <code>create</code> (when the parent directory doesn&#x2019;t exist). - NONE - This lock mode does not acquire any locks for the given path.</p></section></section><section>
  617. <h2><a name="Roadmap"></a>Roadmap</h2><section><section>
  618. <h4><a name="Stage_1:_Split_the_global_lock_into_FSLock_and_BMLock"></a>Stage 1: Split the global lock into FSLock and BMLock</h4>
  619. <p>Split the global lock into two global locks, FSLock and BMLock. - FSLock for operations that relate to namespace tree. - BMLock for operations related to blocks and/or operations related to DNs. - Both FSLock and BMLock for HA related operations. After this step, FGL contains global FSLock and global BMLock.</p>
  620. <p>No big logic changes in this step. The original logic with the global lock retains. This step aims to make the lock mode configurable.</p>
  621. <p>JIRA: <a class="externalLink" href="https://issues.apache.org/jira/browse/HDFS-17384">HDFS-17384</a> [Progress: Done]</p></section><section>
  622. <h4><a name="Stage_2:_Split_the_global_FSLock"></a>Stage 2: Split the global FSLock</h4>
  623. <p>After splitting the global lock into FSLock and BMLock, this step aims to split the global FSLock into full path locks so that fully independent operations that only involve namespace tree can be processed concurrently. In this step, NN still uses the global BMLock to protect block related operations and DN related operations. After this step, FGL contains global FSLock, full path lock, and global BMLock.</p>
  624. <p>JIRA: <a class="externalLink" href="https://issues.apache.org/jira/browse/HDFS-17385">HDFS-17385</a> [Progress: Ongoing]</p></section><section>
  625. <h4><a name="Stage_3:_Split_the_global_BMLock"></a>Stage 3: Split the global BMLock</h4>
  626. <p>This step aims to split the global BMLock into full path locks and DN locks. After this step, FGL contains global FSLock, DN lock, and full path lock.</p>
  627. <p>JIRA: <a class="externalLink" href="https://issues.apache.org/jira/browse/HDFS-17386">HDFS-17386</a> [Progress: Ongoing]</p></section></section></section><section>
  628. <h2><a name="Configuration"></a>Configuration</h2>
  629. <p>NN FGL implementation can be used by adding this configuration to <code>hdfs-site.xml</code>.</p>
  630. <div class="source">
  631. <div class="source">
  632. <pre>&lt;property&gt;
  633. &lt;name&gt;dfs.namenode.lock.model.provider.class&lt;/name&gt;
  634. &lt;value&gt;org.apache.hadoop.hdfs.server.namenode.fgl.FineGrainedFSNamesystemLock&lt;/value&gt;
  635. &lt;description&gt;
  636. An implementation class of FSNamesystem lock.
  637. Defaults to GlobalFSNamesystemLock.class
  638. &lt;/description&gt;
  639. &lt;/property&gt;
  640. </pre></div></div>
  641. <p>The lock manager class must implement the interface defined by <code>org.apache.hadoop.hdfs.server.namenode.fgl.FSNLockManager</code>. Currently, there are two implementations: * <code>org.apache.hadoop.hdfs.server.namenode.fgl.GlobalFSNamesystemLock</code>: the original lock mode that utilizes one global FS lock, also the default value for this config; * <code>org.apache.hadoop.hdfs.server.namenode.fgl.FineGrainedFSNamesystemLock</code>: FGL implementation.</p></section><section>
  642. <h2><a name="Adding_RPC"></a>Adding RPC</h2>
  643. <p>For developers adding a new RPC operation, the operation should follow FGL locking schematic to ensure data integrity: * Global FSLock should be acquired in read mode, unless it is an administrative operation (related to HA, edit logs, etc.) * If the operation requires access/modification of <code>DatanodeDescriptor</code> and/or <code>DatanodeStorageInfo</code>, DN lock should be acquired in read/write mode accordingly. * Only applicable in stage 3 once DN lock is implemented. During stage 1 and stage 2, global BMLock is to be used instead. * If the operation deals with one or more paths/blocks, the full path lock(s) should be acquired based on the implementation details described above. It is best to check an existing RPC operation that has a similar method of access to the new operation to consult the lock implementation.</p></section>
  644. </div>
  645. </div>
  646. <div class="clear">
  647. <hr/>
  648. </div>
  649. <div id="footer">
  650. <div class="xright">
  651. &#169; 2008-2025
  652. Apache Software Foundation
  653. - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
  654. Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
  655. </div>
  656. <div class="clear">
  657. <hr/>
  658. </div>
  659. </div>
  660. </body>
  661. </html>