tkhurana commented on code in PR #2574: URL: https://github.com/apache/phoenix/pull/2574#discussion_r3707688572
########## phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ServerScanUtil.java: ########## @@ -0,0 +1,134 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.coprocessor; + +import java.io.IOException; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; +import org.apache.hadoop.hbase.regionserver.Region; +import org.apache.hadoop.hbase.regionserver.RegionScanner; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.phoenix.coprocessorclient.BaseScannerRegionObserverConstants; +import org.apache.phoenix.filter.PagingFilter; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.types.PBoolean; +import org.apache.phoenix.util.ScanUtil; + +/** + * Utilities for internal server-side region scans that must honor Phoenix TTL exactly like a client + * read. The client normally sets the empty-column and TTL scan attributes + * ({@link org.apache.phoenix.util.ScanUtil#setScanAttributesForPhoenixTTL}) and the coprocessor + * hook {@code BaseScannerRegionObserver.postScannerOpen} wraps the scan in a + * {@link TTLRegionScanner}. Internal scans opened directly via {@code region.getScanner(scan)} + * bypass that hook, so they set no attributes and are never TTL-masked. These helpers reproduce + * both steps for server-side callers (e.g. {@code IndexRegionObserver} current-row reads) so an + * internal scan masks identically to a client scan. + */ +public class ServerScanUtil { Review Comment: Why did we introduce a server side scanner which duplicates most of the work the existing client scanner does. An alternative option would have been to make sure these scans are also handled by BaseScannerRegionObserver by making sure `isRegionObserverFor(scan)` returns true for these -- 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]
