zachjsh commented on code in PR #13165:
URL: https://github.com/apache/druid/pull/13165#discussion_r1007371257


##########
extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/sync/CachedMetadataCatalog.java:
##########
@@ -0,0 +1,229 @@
+/*
+ * 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.druid.catalog.sync;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.druid.catalog.model.ResolvedTable;
+import org.apache.druid.catalog.model.SchemaRegistry;
+import org.apache.druid.catalog.model.SchemaRegistry.SchemaSpec;
+import org.apache.druid.catalog.model.TableDefnRegistry;
+import org.apache.druid.catalog.model.TableId;
+import org.apache.druid.catalog.model.TableMetadata;
+import org.apache.druid.catalog.sync.MetadataCatalog.CatalogListener;
+import org.apache.druid.guice.annotations.Json;
+
+import javax.inject.Inject;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Caching version of the metadata catalog. Draws information
+ * from a base catalog. Fetches from the base if:
+ * <ul>
+ * <li>A table is requested that has not yet been requested.
+ * Once requested, the entry is cached, even if the table does
+ * not exist in the base catalog.</li>
+ * <li>The contents of a schema are requested, and have not yet
+ * been fetched.</li>
+ * </ul>
+ *
+ * Both tables and schemas are cached. In particular, if a table or
+ * schema is requested, and does not exist in the base catalog, then
+ * that schema is marked as not existing and won't be fetched again.
+ *
+ * The cache is updated via an update facility which either flushes
+ * the cache (crude) or listens to the base catalog for updates and
+ * populates the cache with updates. For a local cache, the DB layer
+ * provides the updates. For a remote cache, the DB host pushes updates.
+ */
+public class CachedMetadataCatalog implements MetadataCatalog, CatalogListener
+{
+  public static final int NOT_FETCHED = -1;
+  public static final int UNDEFINED = 0;
+
+  private static class TableEntry
+  {
+    private final TableMetadata table;
+
+    protected TableEntry(SchemaSpec schema, TableMetadata table)

Review Comment:
   schema parameter doesn't seem to be used



-- 
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