POC Code changes for Data Locality and Data View#157
Conversation
|
@copilot Review the PR |
|
@copilot review the PR |
…rds, thread-safety, off-by-one Agent-Logs-Url: https://github.com/ABFSDriver/AbfsHadoop/sessions/9ea398e3-3b3c-408a-ab33-cec387ae77ed Co-authored-by: bhattmanish98 <52626736+bhattmanish98@users.noreply.github.com>
Here is a comprehensive review of the Data Locality and Data View POC changes (commits ✅ What's Good
🐛 Bugs Fixed (commit
|
|
@copilot Please review |
…t, remove dead MAX_CACHE_WEIGHT Agent-Logs-Url: https://github.com/ABFSDriver/AbfsHadoop/sessions/b1c4b2c9-5521-44a8-94a6-08495607027d Co-authored-by: bhattmanish98 <52626736+bhattmanish98@users.noreply.github.com>
The author addressed all 6 design issues from the previous review in commits ✅ Issues Addressed by Author (
|
|
@copilot Please review |
…fix trailing newline Agent-Logs-Url: https://github.com/ABFSDriver/AbfsHadoop/sessions/86c84130-21d6-4eb2-9db6-11064bbee64c Co-authored-by: bhattmanish98 <52626736+bhattmanish98@users.noreply.github.com>
The author addressed all remaining design concerns in commit ✅ All Design Issues Now Addressed
🐛 Minor Fixes (
|
Description of PR
POC implementation of Data Locality and Data View features for Azure Blob File System (ABFS). This includes:
BlobLayoutCache: Singleton Caffeine-backed cache storing blob layout (range-to-endpoint mappings) keyed by file ETag. Supports weighted eviction, active-stream lease logic, and in-flight promise deduplication to avoid redundant network calls. Houses a shared staticfetchExecutor(with JVM shutdown hook) used by all streams. Promise registry access encapsulated viaprocessInFlightPromises(eTag, action)which atomically applies caller logic inside aConcurrentHashMap.computecall.BlobLayout: Lock-free range management usingConcurrentSkipListMap. Tracks which byte ranges are cached per blob, merges overlapping ranges, and computes gaps for efficient fetching.BlobLayoutXmlParser/BlobLayoutResponse: SAX-based XML parser and response model for theGetBlobLayoutAPI (Azure Blob endpoint?comp=layout).addBlobLayoutResponsecorrectly accumulates ranges and endpoints across paginated responses.AbfsInputStream: Extended to support data-locality-aware reads. Whenfs.azure.enable.data.locality=trueand the client isAbfsBlobClient(checked at construction time viaisDataLocalityCheckEnabled), reads are routed to the endpoint hosting the relevant byte range. Async layout fetching with gap bridging viaregisterAndFetch/buildCompositeFuturewith short-circuit exception propagation.AbfsBlobClient: AddedgetBlobLayout()method to call the new layout API.KeepAliveCache: Redesigned with separate default/cluster host pools,ConcurrentLinkedDeque-backedHostQueue, atomic eviction viainUseflag, and daemon thread pools to prevent JVM hang on exit.ReadBufferManagerV2: ExtendedqueueReadAheadto acceptList<BlobLayout.BlobRange>segments for per-range child-buffer queuing, enabling data-locality-aware prefetch. Removed duplicateLOCKfield that shadowed the parent class.AbfsConfiguration: Added configuration keys for data locality (fs.azure.enable.data.locality), blob layout cache eviction timeout, cache max weight, and configurable layout fetch timeout (fs.azure.blob.layout.fetch.timeout.millis, default 10s).Bug fixes and improvements applied during code review:
AbfsInputStream.close():deregisterStreamwas called withpathinstead ofeTag, preventing cache eviction.AbfsInputStream.findEndpointForPosition(): AddedisEmpty()guard beforeblobRanges.get(0)to preventIndexOutOfBoundsException.AbfsInputStream.getBlobLayout(): Fixed wrongTracingContextbeing mutated (caller's copy instead of the local copy).AbfsInputStream:isDataLocalityCheckEnablednow includesclient instanceof AbfsBlobClient, ensuring the data locality path is only taken on Blob endpoint streams.BlobLayoutCache.putBlobLayout(): ReplacedisLayoutPresent = new AtomicBoolean(false)withisLayoutPresent.set(false)to avoid a non-atomic field replacement data race. Removed deadMAX_CACHE_WEIGHTconstant.BlobLayoutCache.fetchExecutor: Moved from a per-instance field inAbfsInputStreamto a shared static inBlobLayoutCachewith a JVM shutdown hook for orderly cleanup, preventing per-stream thread pool proliferation.BlobLayoutCache.processInFlightPromises(): Replaced directpromiseRegistryexposure with an atomic compute-based API;getFetchExecutor()made package-private.ReadBufferManagerV2.queueReadAhead(): Fixed off-by-one (> bufferPool.length→>= bufferPool.length) that could causeArrayIndexOutOfBoundsException.BlobLayout.getMergedRangesInternal(): Replacednext.host().equals()withObjects.equals(next.host(), ...)to prevent NPE when host is null (valid for gap ranges).How was this patch tested?
BlobLayoutCacheTest(including tests forprocessInFlightPromisesinitialization, persistence, error propagation, concurrency, and async behavior),BlobLayoutTest,TestAbfsInputStream,TestApacheClientConnectionPoolITestAbfsClient,ITestAbfsInputStream(including tests for sub-interval coalescing, bridge gap splitting, partial failure short-circuit, and single-byte boundary),ITestAbfsInputStreamReadFooter,ITestAbfsInputStreamSmallFileReads,ITestReadBufferManagerV2For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?AI Tooling
If an AI tool was used:
https://www.apache.org/legal/generative-tooling.html
Contains content generated by GitHub Copilot