You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/10/30 07:42:40 UTC

[kylin] branch 2.5.x updated (bfb9055 -> cf6d58b)

This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a change to branch 2.5.x
in repository https://gitbox.apache.org/repos/asf/kylin.git.


    from bfb9055  KYLIN-3649 segment region count and size are not correct when using mysql as Kylin metadata storage
     new 3a441f2  KYLIN-3556, replace String.intern to avoid unexpected locking collisions
     new cf6d58b  KYLIN-3582 String compare should use equals method

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/kylin/common/persistence/JDBCResourceDAO.java   | 14 ++++++++++----
 .../org/apache/kylin/metrics/lib/impl/RecordEvent.java     |  3 +--
 2 files changed, 11 insertions(+), 6 deletions(-)


[kylin] 01/02: KYLIN-3556, replace String.intern to avoid unexpected locking collisions

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch 2.5.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 3a441f2e3d464265b15d6c1bf90e375f156dae7c
Author: etherge <et...@163.com>
AuthorDate: Mon Oct 29 17:39:44 2018 +0800

    KYLIN-3556, replace String.intern to avoid unexpected locking collisions
---
 .../apache/kylin/common/persistence/JDBCResourceDAO.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java b/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java
index 5ad484a..9a33716 100644
--- a/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java
+++ b/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java
@@ -30,6 +30,7 @@ import java.sql.SQLException;
 import java.sql.Types;
 import java.text.MessageFormat;
 import java.util.List;
+import java.util.NavigableSet;
 import java.util.TreeSet;
 
 import org.apache.commons.io.IOUtils;
@@ -43,6 +44,8 @@ import org.apache.kylin.common.util.HadoopUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Interner;
+import com.google.common.collect.Interners;
 import com.google.common.collect.Lists;
 
 public class JDBCResourceDAO {
@@ -69,6 +72,7 @@ public class JDBCResourceDAO {
     private FileSystem redirectFileSystem;
 
     public static final String LOG_TABLE_SUFFIX = "_log";
+    private Interner<String> interner = Interners.newStrongInterner();
 
     public JDBCResourceDAO(KylinConfig kylinConfig, String metadataIdentifier) throws SQLException {
         this.kylinConfig = kylinConfig;
@@ -160,7 +164,8 @@ public class JDBCResourceDAO {
         return allResourceName;
     }
 
-    private void listResource(final String tableName, final String folderPath, final TreeSet<String> allResourceName, final boolean recursive) throws SQLException {
+    private void listResource(final String tableName, final String folderPath,
+                              final NavigableSet<String> allResourceName, final boolean recursive) throws SQLException {
         executeSql(new SqlOperation() {
             @Override
             public void execute(Connection connection) throws SQLException {
@@ -278,7 +283,7 @@ public class JDBCResourceDAO {
             @Override
             public void execute(Connection connection) throws SQLException {
                 byte[] content = getResourceDataBytes(resource);
-                synchronized (resource.getPath().intern()) {
+                synchronized (interner.intern(resource.getPath())) {
                     boolean existing = existResource(resource.getPath());
                     String tableName = getMetaTableName(resource.getPath());
                     if (existing) {
@@ -329,7 +334,7 @@ public class JDBCResourceDAO {
         executeSql(new SqlOperation() {
             @Override
             public void execute(Connection connection) throws SQLException {
-                synchronized (resPath.intern()) {
+                synchronized (interner.intern(resPath)) {
                     String tableName = getMetaTableName(resPath);
                     if (!existResource(resPath)) {
                         if (oldTS != 0) {
@@ -460,8 +465,9 @@ public class JDBCResourceDAO {
 
             private boolean checkTableExists(final String tableName, final Connection connection) throws SQLException {
                 final PreparedStatement ps = connection.prepareStatement(getCheckTableExistsSql(tableName));
-                final ResultSet rs = ps.executeQuery();
+                ResultSet rs = null;
                 try {
+                    rs = ps.executeQuery();
                     while (rs.next()) {
                         if (tableName.equals(rs.getString(1))) {
                             return true;


[kylin] 02/02: KYLIN-3582 String compare should use equals method

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch 2.5.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit cf6d58b0d518deda28c3a9c3992106313c10acae
Author: hit-lacus <hi...@126.com>
AuthorDate: Mon Sep 24 23:18:54 2018 +0800

    KYLIN-3582 String compare should use equals method
---
 .../src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
index f5bc797..93da2f4 100644
--- a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
+++ b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
@@ -261,11 +261,10 @@ public class RecordEvent implements Record, Map<String, Object>, Serializable {
 
         public RecordReserveKeyEnum getByKey(String key) {
             for (RecordReserveKeyEnum reserveKey : RecordReserveKeyEnum.values()) {
-                if (reserveKey.reserveKey == key) {
+                if (reserveKey.reserveKey.equals(key)) {
                     return reserveKey;
                 }
             }
-
             return null;
         }
     }