-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed Postgres related storage issues
* added getKeyspaces method to JmxProxy
- Loading branch information
1 parent
c6a07bb
commit 8de0139
Showing
8 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/spotify/reaper/storage/postgresql/PostgresArrayArgumentFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.spotify.reaper.storage.postgresql; | ||
|
||
import org.skife.jdbi.v2.StatementContext; | ||
import org.skife.jdbi.v2.tweak.Argument; | ||
import org.skife.jdbi.v2.tweak.ArgumentFactory; | ||
|
||
import java.sql.Array; | ||
import java.sql.PreparedStatement; | ||
import java.sql.SQLException; | ||
import java.util.Collection; | ||
|
||
/** | ||
* Required as we are using JDBI, and it cannot do Array binding otherwise, duh. | ||
*/ | ||
public class PostgresArrayArgumentFactory implements ArgumentFactory<Collection<String>> { | ||
|
||
@Override | ||
public boolean accepts(Class<?> expectedType, Object value, StatementContext ctx) { | ||
return value instanceof Collection; | ||
} | ||
|
||
@Override | ||
public Argument build(Class<?> expectedType, final Collection<String> value, | ||
StatementContext ctx) { | ||
return new Argument() { | ||
public void apply(int position, | ||
PreparedStatement statement, | ||
StatementContext ctx) throws SQLException { | ||
Array sqlArray = ctx.getConnection().createArrayOf("text", value.toArray()); | ||
statement.setArray(position, sqlArray); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ logging: | |
level: DEBUG | ||
loggers: | ||
io.dropwizard: INFO | ||
org.eclipse.jetty: INFO | ||
appenders: | ||
- type: console | ||
|
||
|