Skip to content

Commit

Permalink
Using smart driver instead of postres one (#101)
Browse files Browse the repository at this point in the history
* Revert "Implemented colocated and use yugabyte JDBC driver (#97)"

This reverts commit 69ad677.

* new driver

* Fixed database name

* Merged with master
  • Loading branch information
qvad authored Sep 14, 2023
1 parent 53cc0be commit 99a474e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions yugabyte/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.11.1"]
[clj-http "3.12.3" :exclusions [commons-logging]]
[jepsen "0.3.1"]
[jepsen "0.3.3"]
[com.yugabyte/cassaforte "3.0.0-alpha2-yb-1"]
[org.clojure/java.jdbc "0.7.12"]
[org.clojure/data.json "2.4.0"]
[org.postgresql/postgresql "42.5.1"]
[com.yugabyte/jdbc-yugabytedb "42.3.5-yb-3"]
[version-clj "2.0.2"]
[clj-wallhack "1.0.1"]]
:main yugabyte.runner
Expand Down
4 changes: 2 additions & 2 deletions yugabyte/src/yugabyte/ysql/append_table.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
[:k :timestamp :default "NOW()"]
[:v :int]]
{:conditional? true}))
(catch org.postgresql.util.PSQLException e
(catch com.yugabyte.util.PSQLException e
(when-not (re-find #"already exists" (.getMessage e))
(throw e)))))

Expand All @@ -103,7 +103,7 @@
`(info "Creating table" ~table-sym "and retrying")
`(create-table! ~conn ~table-sym)
body)
~(apply catch-dne 'org.postgresql.util.PSQLException table-sym
~(apply catch-dne 'com.yugabyte.util.PSQLException table-sym
`(info "Creating table" ~table-sym "and retrying")
`(create-table! ~conn ~table-sym)
body)
Expand Down
8 changes: 4 additions & 4 deletions yugabyte/src/yugabyte/ysql/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
(defn db-spec
"Assemble a JDBC connection specification for a given Jepsen node."
[node]
{:dbtype "postgresql"
{:dbtype "yugabytedb"
:dbname "postgres"
:classname "org.postgresql.Driver"
:classname "com.yugabyte.Driver"
:host (name node)
:port ysql-port
:user "postgres"
Expand Down Expand Up @@ -178,7 +178,7 @@
(update op :error (partial vector :batch)))
{:type :info, :error [:batch-update m]})

org.postgresql.util.PSQLException
com.yugabyte.util.PSQLException
(condp re-find m
#"(?i)Conflicts with [- a-z]+ transaction"
{:type :fail, :error [:conflicting-transaction m]}
Expand Down Expand Up @@ -300,7 +300,7 @@
[& body]
`(util/with-retry [attempts# max-retry-attempts]
~@body
(catch org.postgresql.util.PSQLException e#
(catch com.yugabyte.util.PSQLException e#
(let [m# (.getMessage e#)]
(if (or (re-find #"duplicate key value violates unique constraint" m#)
(re-find #"A relation has an associated type of the same name" m#)
Expand Down
6 changes: 3 additions & 3 deletions yugabyte/src/yugabyte/ysql/default_value.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
[[:dummy :int]
[:v :int :default "0"]]
{:conditional? true}))
(catch org.postgresql.util.PSQLException e
(catch com.yugabyte.util.PSQLException e
(when-not (re-find #"already exists" (.getMessage e))
(throw e)))))

Expand Down Expand Up @@ -81,7 +81,7 @@
`(info "Creating table" ~table-sym "and retrying")
`(create-table! ~conn ~table-sym)
body)
~(apply catch-dne 'org.postgresql.util.PSQLException table-sym
~(apply catch-dne 'com.yugabyte.util.PSQLException table-sym
`(info "Creating table" ~table-sym "and retrying")
`(create-table! ~conn ~table-sym)
body)
Expand All @@ -108,7 +108,7 @@
(assoc op :type :ok))
:drop-column (do (drop-column! c table (:value op))
(assoc op :type :ok)))
(catch org.postgresql.util.PSQLException e
(catch com.yugabyte.util.PSQLException e
(if (re-find #"column .+ does not exist" (.getMessage e))
(assoc op :type :fail, :error :column-does-not-exist)
(throw e))))))
Expand Down

0 comments on commit 99a474e

Please sign in to comment.