Skip to content

Commit

Permalink
use ownerColumn() instead of ownerColum()
Browse files Browse the repository at this point in the history
  • Loading branch information
lachja committed Jul 13, 2023
1 parent d621fad commit 6791cbf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PreparedStatement createTable(Connection connection, TokenSchema schema)
schema.tokenColumn() + " " + tokenType() + " NULL,\n" +
schema.tokenTypeColumn() + " VARCHAR(255) NULL,\n" +
schema.timestampColumn() + " VARCHAR(255) NULL,\n" +
schema.ownerColum() + " VARCHAR(255) NULL,\n" +
schema.ownerColumn() + " VARCHAR(255) NULL,\n" +
"PRIMARY KEY (" + schema.processorNameColumn() + "," + schema.segmentColumn() + ")\n" +
")";
return connection.prepareStatement(sql);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ protected PreparedStatement select(Connection connection, String processorName,
int segment, boolean forUpdate) throws SQLException {
final String sql = "SELECT " +
String.join(", ", schema.processorNameColumn(), schema.segmentColumn(), schema.tokenColumn(),
schema.tokenTypeColumn(), schema.timestampColumn(), schema.ownerColum()) + " FROM " +
schema.tokenTypeColumn(), schema.timestampColumn(), schema.ownerColumn()) + " FROM " +
schema.tokenTable() + " WHERE " + schema.processorNameColumn() + " = ? AND " + schema.segmentColumn() +
" = ? " + (forUpdate ? "FOR UPDATE" : "");
PreparedStatement preparedStatement = connection.prepareStatement(sql);
Expand All @@ -493,7 +493,7 @@ protected PreparedStatement select(Connection connection, String processorName,
*/
protected void updateToken(Connection connection, ResultSet resultSet, TrackingToken token, String processorName,
int segment) throws SQLException {
final String sql = "UPDATE " + schema.tokenTable() + " SET " + schema.ownerColum() + " = ?, " +
final String sql = "UPDATE " + schema.tokenTable() + " SET " + schema.ownerColumn() + " = ?, " +
schema.tokenColumn() + " = ?, " + schema.tokenTypeColumn() + " = ?, " + schema.timestampColumn() +
" = ? WHERE " + schema.processorNameColumn() + " = ? AND " + schema.segmentColumn() + " = ?";
if (resultSet.next()) {
Expand Down Expand Up @@ -536,7 +536,7 @@ protected void updateToken(Connection connection, ResultSet resultSet, TrackingT
* @throws SQLException when an exception occurs while claiming the token entry
*/
protected TrackingToken claimToken(Connection connection, AbstractTokenEntry<?> entry) throws SQLException {
final String sql = "UPDATE " + schema.tokenTable() + " SET " + schema.ownerColum() + " = ?, " +
final String sql = "UPDATE " + schema.tokenTable() + " SET " + schema.ownerColumn() + " = ?, " +
schema.timestampColumn() + " = ? WHERE " + schema.processorNameColumn() + " = ? AND " +
schema.segmentColumn() + " = ?";
if (!entry.claim(nodeId, claimTimeout)) {
Expand Down Expand Up @@ -641,12 +641,12 @@ protected void validateSegment(String processorName, Segment segment) {
}

/**
* Returns a {@link PreparedStatement} for the count of segments that can be found after searching for the {@code splitSegmentId} and {@code mergableSegmetnId}.
* Returns a {@link PreparedStatement} for the count of segments that can be found after searching for the {@code splitSegmentId} and {@code mergeableSegmentId}.
*
* @param connection the connection to the underlying database
* @param processorName the name of the processor to load or insert a token entry for
* @param splitSegmentId the id of the split candidate segment
* @param mergeableSegmentId the id of the merge candiate segment
* @param mergeableSegmentId the id of the merge candidate segment
* @return The PreparedStatement to execute
* @throws SQLException when an Exception occurs in building the {@link PreparedStatement}
*/
Expand Down Expand Up @@ -700,7 +700,7 @@ protected TrackingToken insertTokenEntry(Connection connection, TrackingToken to
int segment) throws SQLException {
final String sql = "INSERT INTO " + schema.tokenTable() + " (" + schema.processorNameColumn() + "," +
schema.segmentColumn() + "," + schema.timestampColumn() + "," + schema.tokenColumn() + "," +
schema.tokenTypeColumn() + "," + schema.ownerColum() + ") VALUES (?,?,?,?,?,?)";
schema.tokenTypeColumn() + "," + schema.ownerColumn() + ") VALUES (?,?,?,?,?,?)";
AbstractTokenEntry<?> entry = new GenericTokenEntry<>(token, serializer, contentType, processorName, segment);

try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
Expand All @@ -727,7 +727,7 @@ protected AbstractTokenEntry<?> readTokenEntry(ResultSet resultSet) throws SQLEx
return new GenericTokenEntry<>(readSerializedData(resultSet, schema.tokenColumn()),
resultSet.getString(schema.tokenTypeColumn()),
resultSet.getString(schema.timestampColumn()),
resultSet.getString(schema.ownerColum()),
resultSet.getString(schema.ownerColumn()),
resultSet.getString(schema.processorNameColumn()),
resultSet.getInt(schema.segmentColumn()), contentType);
}
Expand All @@ -745,9 +745,9 @@ protected AbstractTokenEntry<?> readTokenEntry(ResultSet resultSet) throws SQLEx
protected PreparedStatement releaseClaim(Connection connection, String processorName,
int segment) throws SQLException {
final String sql =
"UPDATE " + schema.tokenTable() + " SET " + schema.ownerColum() + " = ?, " + schema.timestampColumn() +
"UPDATE " + schema.tokenTable() + " SET " + schema.ownerColumn() + " = ?, " + schema.timestampColumn() +
" = ? WHERE " + schema.processorNameColumn() + " = ? AND " + schema.segmentColumn() +
" = ? AND " + schema.ownerColum() + " = ?";
" = ? AND " + schema.ownerColumn() + " = ?";
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, null);
preparedStatement.setString(2, formatInstant(AbstractTokenEntry.clock.instant()));
Expand All @@ -772,7 +772,7 @@ protected PreparedStatement deleteToken(Connection connection, String processorN
final String sql =
"DELETE FROM " + schema.tokenTable() +
" WHERE " + schema.processorNameColumn() + " = ? AND " + schema.segmentColumn() +
" = ? AND " + schema.ownerColum() + " = ?";
" = ? AND " + schema.ownerColumn() + " = ?";
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, processorName);
preparedStatement.setInt(2, segment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PreparedStatement createTable(Connection connection, TokenSchema schema)
schema.tokenColumn() + " " + " BLOB NULL,\n" +
schema.tokenTypeColumn() + " VARCHAR(255) NULL,\n" +
schema.timestampColumn() + " VARCHAR(255) NULL,\n" +
schema.ownerColum() + " VARCHAR(255) NULL,\n" +
schema.ownerColumn() + " VARCHAR(255) NULL,\n" +
"PRIMARY KEY (" + schema.processorNameColumn() + "," + schema.segmentColumn() + ")\n" +
")";
return connection.prepareStatement(sql);
Expand Down

0 comments on commit 6791cbf

Please sign in to comment.