You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "kadirozde (via GitHub)" <gi...@apache.org> on 2023/03/22 00:38:51 UTC

[GitHub] [phoenix] kadirozde commented on a diff in pull request #1575: PHOENIX-6141 : Ensure consistency between SYSTEM.CATALOG and SYSTEM.CHILD_LINK

kadirozde commented on code in PR #1575:
URL: https://github.com/apache/phoenix/pull/1575#discussion_r1144116907


##########
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ChildLinkMetaDataEndpoint.java:
##########
@@ -111,4 +141,245 @@ private PhoenixMetaDataCoprocessorHost getCoprocessorHost() {
 		return phoenixAccessCoprocessorHost;
 	}
 
+    /**
+     * Class that verifies a given row of a SYSTEM.CHILD_LINK table.
+     * An instance of this class is created for each scanner on the table
+     * and used to verify individual rows.
+     */
+    public class ChildLinkMetaDataScanner extends BaseRegionScanner {
+
+        private RegionScanner scanner;
+        private Scan scan;
+        private RegionCoprocessorEnvironment env;
+        private Scan sysCatScan = null;
+        private Scan childLinkScan;
+        private byte[] emptyCF;
+        private byte[] emptyCQ;
+        private Region region;
+        private boolean hasMore;
+        private long pageSizeMs;
+        private long pageSize = Long.MAX_VALUE;
+        private long rowCount = 0;
+        private long maxTimestamp;
+        private long ageThreshold;
+
+        public ChildLinkMetaDataScanner(RegionCoprocessorEnvironment env,
+                                        Scan scan,
+                                        RegionScanner scanner) {
+            super(scanner);
+            this.env = env;
+            this.scan = scan;
+            this.scanner = scanner;
+            region = env.getRegion();
+            emptyCF = scan.getAttribute(EMPTY_COLUMN_FAMILY_NAME);
+            emptyCQ = scan.getAttribute(EMPTY_COLUMN_QUALIFIER_NAME);
+            pageSizeMs = getPageSizeMsForRegionScanner(scan);
+            maxTimestamp = scan.getTimeRange().getMax();
+            ageThreshold = env.getConfiguration().getLong(
+                    QueryServices.CHILD_LINK_ROW_AGE_THRESHOLD_TO_DELETE_MS_ATTRIB,
+                    QueryServicesOptions.DEFAULT_CHILD_LINK_ROW_AGE_THRESHOLD_TO_DELETE_MS);
+        }
+
+        public boolean next(List<Cell> result, boolean raw) throws IOException {
+            try {
+                long startTime = EnvironmentEdgeManager.currentTimeMillis();
+                do {
+                    if (raw) {
+                        hasMore = scanner.nextRaw(result);
+                    } else {
+                        hasMore = scanner.next(result);
+                    }
+                    if (result.isEmpty()) {
+                        break;

Review Comment:
   This should be "return hasMore" instead of "break" as you do not want to count empty rows. This is also a bug in GlobalIndexChecker and my PR https://github.com/apache/phoenix/pull/1569 fixes it.



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org