eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ralp...@apache.org
Subject incubator-eagle git commit: EAGLE-213 Updates fail for MySql
Date Wed, 06 Apr 2016 04:47:21 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master a3986fccb -> 1026b8487


EAGLE-213 Updates fail for MySql

There was a check based on the exception message, which was not correct
for MySql. Changed it to more generic, comparing with "duplicate", it will handle
more broader range now.

Author: Jaspaul, Jashchahal
Reviewer: Ralph, Su; Chen, Hao
Closed: #136


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/1026b848
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/1026b848
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/1026b848

Branch: refs/heads/master
Commit: 1026b84877abd2fd0ab49bd734d47cccbff54d07
Parents: a3986fc
Author: Ralph, Su <suliangfei@gmail.com>
Authored: Wed Apr 6 12:14:11 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Wed Apr 6 12:14:11 2016 +0800

----------------------------------------------------------------------
 .../eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1026b848/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
index de15384..5a04ae6 100644
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
+++ b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
@@ -87,8 +87,8 @@ public class JdbcEntityWriterImpl<E extends TaggedLogAPIEntity> implements
JdbcE
                     assert key != null;
                     throw new RuntimeException("Key is not in type of String (VARCHAR) ,
but JdbcType (java.sql.Types): " + key.getJdbcType() + ", value: " + key.getValue(), ex);
                 } catch (ConstraintViolationException e){
-                    // Override with updating if duplicated key exception
-                    if(e.getMessage().contains("The statement was aborted because it would
have caused a duplicate key value in a unique or primary key constraint or unique index identified
by")){
+                    //this message will be different in each DB type ...using duplicate keyword
to catch for broader set of DBs. moreover we are already inside ConstraintViolationException
exception, do we even need this check?
+                    if(e.getMessage().toLowerCase().contains("duplicate")){
                         String primaryKey = entity.getEncodedRowkey();
                         if(primaryKey==null) {
                             primaryKey = ConnectionManagerFactory.getInstance().getStatementExecutor().getPrimaryKeyBuilder().build(entity);


Mime
View raw message