akshat-lakhera opened a new pull request, #20808:
URL: https://github.com/apache/druid/pull/20808

   Part of #20525.
   
   ### Description
   
   This is the last slice of the "DataSegment constructors and no-argument 
builder()" group in #20525. The earlier slices (#20788 and #20795) moved the 
callers outside the server module to DataSegment.builder(SegmentId). This one 
moves what was left and then removes the deprecated API itself, as discussed in 
the review of #20795.
   
   The server module had 65 no-argument builder() chains and 159 constructor 
calls across 69 test files, and they now use the builder. I also found five 
builder() chains that the earlier slices missed because the call was split over 
two lines (MSQScanBenchmarkBase, TaskLifecycleTest, S3DataSegmentArchiverTest 
and OssDataSegmentArchiverTest), plus the 
DruidSchemaInternRowSignatureBenchmark chain I left alone last time. The 
rewrite is the same as before: SegmentId.of(dataSource, interval, version, 
partition), with the partition taken from the shard spec, and asSegmentId() 
wherever the allocated identifier is at hand. In the three Period rule tests 
and the benchmark a single builder is reused and the interval is set per 
segment, so that builder starts from Intervals.ETERNITY, which is always 
overridden before build().
   
   With no callers left, DataSegment.builder() with no arguments, its private 
no-argument Builder constructor and the 9 and 10 argument public constructors 
are removed. They were deprecated in #18223 (Druid 34). The 15 argument 
constructor, the Jackson creator and builder(SegmentId), builder(DataSegment) 
and builder(Builder) stay.
   
   As in slice 2, the old builder started with an empty loadSpec and a null 
binaryVersion, while builder(SegmentId) starts with a null loadSpec and 
binaryVersion 0. Two tests depended on that. ServersResourceTest compares exact 
JSON, and DataSourcesResourceTest runs a partial load rule that needs a 
non-null loadSpec, so those two now set the values explicitly. The other test 
chains are unchanged, the same as in #20795.
   
   #### Release note
   
   Removed the deprecated DataSegment.builder() with no arguments and the 9 and 
10 argument DataSegment constructors, deprecated since Druid 34 (#18223). 
Extensions or custom code that still call them need to switch to 
DataSegment.builder(SegmentId) or DataSegment.builder(DataSegment). The old 
no-argument builder started with an empty load spec and a null binary version, 
while builder(SegmentId) starts with a null load spec and binary version 0, so 
set those explicitly if your code relied on the old defaults.
   
   #### Testing
   
   processing, server, indexing-service, benchmarks and the s3 and aliyun-oss 
extensions compile and pass checkstyle, and nothing in the repo calls the 
removed API anymore. I ran all 68 changed server test classes on my Windows 
machine. IndexerSQLMetadataStorageCoordinatorTest, the compaction, balancer and 
rule tests, ServersResourceTest and DataSourcesResourceTest pass. The 
SegmentLocalCacheManager, SegmentManager and 
CoordinatorSegmentMetadataCacheTest classes fail on Windows paths and file 
locks, with the same counts before and after this change, so I'm relying on CI 
for those and for the sql and multi-stage-query suites.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * DataSegment (deprecated builder and constructors removed)
    * the server test classes, for example 
IndexerSQLMetadataStorageCoordinatorTest, 
IndexerSqlMetadataStorageCoordinatorTestBase, CompactSegmentsTest, 
NewestSegmentFirstPolicyTest and CachingClusteredClientTest
    * DruidSchemaInternRowSignatureBenchmark and MSQScanBenchmarkBase
    * TaskLifecycleTest, S3DataSegmentArchiverTest and 
OssDataSegmentArchiverTest
   
   <hr>
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] a release note entry in the PR description.
   - [x] been tested with the existing unit tests of the changed classes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to