Skip to content

Commit

Permalink
Merge pull request #61 from rayokota/kcache-3.2.3
Browse files Browse the repository at this point in the history
Upgrade to KCache 3.2.3
  • Loading branch information
rayokota authored Sep 6, 2020
2 parents a14339c + c1b9adb commit 4452343
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
9 changes: 6 additions & 3 deletions kareldb-core/src/main/java/io/kareldb/schema/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ private boolean update(Object o) {
keyValue.right[inverseIndex - keySize] = (Comparable) colValue;
}
}
boolean replaced = cache.replace(oldKey, oldValue, keyValue.left, keyValue.right);
if (replaced) {
rowsAffected++;
boolean replaced = false;
if (!Arrays.equals(oldKey, keyValue.left) || !Arrays.equals(oldValue, keyValue.right)) {
replaced = cache.replace(oldKey, oldValue, keyValue.left, keyValue.right);
if (replaced) {
rowsAffected++;
}
}
return replaced;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ protected Properties createProperties() {
"org.apache.calcite.sql.ddl.ExtensionDdlExecutor#PARSER_FACTORY");
properties.put("schema.kind", "io.kareldb.kafka.KafkaSchema");
properties.put("schema.kafkacache.bootstrap.servers", bootstrapServers);
properties.put("schema.rocksdb.enable", "true");
// TODO reenable RocksDB for tests
properties.put("schema.rocksdb.enable", "false");
properties.put("schema.rocksdb.root.dir", tempDir.getAbsolutePath());
return properties;
}
Expand Down
16 changes: 14 additions & 2 deletions kareldb-core/src/test/java/io/kareldb/jdbc/DateTimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public void testRandom() throws SQLException {
JDBC.assertFullResultSet(rs, new String[][]{{"3245-09-09",
"1001-06-07", "1999-01-05"}}, true);

assertUpdateCount(st, 2, " update sertest set d=s");
assertUpdateCount(st, 1, " update sertest set d=s");

// should get type errors:
assertStatementError("42821", st,
Expand All @@ -574,7 +574,19 @@ public void testRandom() throws SQLException {
" insert into sertest values (null, null, "
+ "timestamp'1745-01-01 09:30:25')");

assertUpdateCount(st, 2, "update sertest set d=o");
rs = st.executeQuery(" select * from sertest");
JDBC.assertColumnNames(rs, new String[]{"D", "S", "O"});
JDBC.assertFullResultSet(rs, new String[][]{{"1001-06-07",
"1001-06-07", "1999-01-05"}, {"1992-01-03",
"1992-01-03", "1992-01-03"}}, true);

assertUpdateCount(st, 1, "update sertest set d=o");

rs = st.executeQuery(" select * from sertest");
JDBC.assertColumnNames(rs, new String[]{"D", "S", "O"});
JDBC.assertFullResultSet(rs, new String[][]{{"1992-01-03",
"1992-01-03", "1992-01-03"}, {"1999-01-05",
"1001-06-07", "1999-01-05"}}, true);

rs = st.executeQuery(" select * from sertest where s is null " +
"and o is not null");
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ limitations under the License.
<junit.version>4.12</junit.version>
<kafka.scala.version>2.13</kafka.scala.version>
<kafka.version>2.6.0</kafka.version>
<kcache.version>3.2.2</kcache.version>
<kcache.version>3.2.3</kcache.version>
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
<maven-scm-provider.version>1.10.0</maven-scm-provider.version>
Expand Down

0 comments on commit 4452343

Please sign in to comment.