[ 
https://issues.apache.org/jira/browse/GOBBLIN-1459?focusedWorklogId=608737&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-608737
 ]

ASF GitHub Bot logged work on GOBBLIN-1459:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Jun/21 20:48
            Start Date: 08/Jun/21 20:48
    Worklog Time Spent: 10m 
      Work Description: aplex commented on a change in pull request #3298:
URL: https://github.com/apache/gobblin/pull/3298#discussion_r647773079



##########
File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/FlowSpec.java
##########
@@ -467,5 +468,10 @@ public static FlowConfig toFlowConfig(Spec spec) {
           .setFlowName(flowProps.getProperty(ConfigurationKeys.FLOW_NAME_KEY)))
           .setProperties(flowPropsAsStringMap);
     }
+
+    public static int maxFlowSpecUri() {

Review comment:
       we can end the name with "length" or "size" to make it more clear.

##########
File path: gobblin-metastore/src/main/java/org/apache/gobblin/MysqlDagStore.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.gobblin;
+
+import java.io.IOException;
+
+import javax.sql.DataSource;
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.metastore.MysqlStateStore;
+import org.apache.gobblin.service.ServiceConfigKeys;
+
+
+@Slf4j
+/**
+ * An implementation of {@link MysqlStateStore} backed by MySQL to store Dag.
+ *
+ * @param <T> state object type
+ **/
+public class MysqlDagStore<T extends State> extends MysqlStateStore<T> {

Review comment:
       Do we need a separate MysqlDagStore, or we can just bump the lengths in 
the base class?

##########
File path: gobblin-metastore/src/main/java/org/apache/gobblin/MysqlDagStore.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.gobblin;
+
+import java.io.IOException;
+
+import javax.sql.DataSource;
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.metastore.MysqlStateStore;
+import org.apache.gobblin.service.ServiceConfigKeys;
+
+
+@Slf4j
+/**
+ * An implementation of {@link MysqlStateStore} backed by MySQL to store Dag.
+ *
+ * @param <T> state object type
+ **/
+public class MysqlDagStore<T extends State> extends MysqlStateStore<T> {
+  /**
+   * Manages the persistence and retrieval of {@link State} in a MySQL database
+   * @param dataSource the {@link DataSource} object for connecting to MySQL
+   * @param stateStoreTableName the table for storing the state in rows keyed 
by two levels (store_name, table_name)
+   * @param compressedValues should values be compressed for storage?
+   * @param stateClass class of the {@link State}s stored in this state store
+   * @throws IOException in case of failures
+   */
+  public MysqlDagStore(DataSource dataSource, String stateStoreTableName, 
boolean compressedValues,
+      Class<T> stateClass)
+      throws IOException {
+    super(dataSource, stateStoreTableName, compressedValues, stateClass);
+  }
+
+  @Override
+  protected String getCreateJobStateTableTemplate() {
+    int maxStoreName = ServiceConfigKeys.MAX_FLOW_NAME + 
ServiceConfigKeys.STATE_STORE_KEY_SEPARATION_CHARACTER.length()
+        + ServiceConfigKeys.MAX_FLOW_GROUP;
+    int maxTableName = 13; // length of flowExecutionId which is epoch 
timestamp
+
+    return "CREATE TABLE IF NOT EXISTS $TABLE$ (store_name varchar(" + 
maxStoreName + ") CHARACTER SET latin1 COLLATE latin1_bin not null,"

Review comment:
       Looks like we'll use longer column names when new state stores are 
created, but what is our story for the existing DBs? Are we going to ask SREs 
to increase the limit manually, or we'll include some "alter table" in the 
codebase?

##########
File path: 
gobblin-api/src/main/java/org/apache/gobblin/service/ServiceConfigKeys.java
##########
@@ -132,4 +132,11 @@
   // Group Membership authentication service
   public static final String GROUP_OWNERSHIP_SERVICE_CLASS = 
GOBBLIN_SERVICE_PREFIX + "groupOwnershipService.class";
   public static final String DEFAULT_GROUP_OWNERSHIP_SERVICE = 
"org.apache.gobblin.service.NoopGroupOwnershipService";
+
+  public static final int MAX_FLOW_NAME = 128; // defined in FlowId.pdl

Review comment:
       maybe MAX_FLOW_NAME_LENGTH? and same for the next config.

##########
File path: 
gobblin-metastore/src/main/java/org/apache/gobblin/metastore/MysqlJobStatusStateStore.java
##########
@@ -70,6 +71,21 @@ public MysqlJobStatusStateStore(DataSource dataSource, 
String stateStoreTableNam
     return getAll(storeName, flowExecutionId + "%", true);
   }
 
+  @Override
+  protected String getCreateJobStateTableTemplate() {

Review comment:
       Would be good to add a couple of tests that will verify the state store 
behavior with long names. Older version of MySql with a certain db layout types 
would limit the total length of the primary key to about 700-800 bytes. At the 
same time, it was possible to define any limits in table schema, even more than 
800 total bytes. But, when you try to insert a long key, a runtime exception 
will occur.




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

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 608737)
    Time Spent: 50m  (was: 40m)

> correct column length in MysqlSpecStore, MysqlDagStore, MysqlJobStatusStore
> ---------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1459
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1459
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> some column length in MysqlSpecStore, MysqlDagStore, MysqlJobStatusStore are 
> incorrect. limit on these column lengths is decided by the limit on flow 
> group and flow name limits



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to