Skip to content

Commit 60c000f

Browse files
committed
Rename setReadOnly() to setConnectionToReadOnly()
1 parent 4524f78 commit 60c000f

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

core/src/main/java/com/scalar/db/storage/jdbc/JdbcAdmin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public TableMetadata getTableMetadata(String namespace, String table) throws Exe
438438
boolean tableExists = false;
439439

440440
try (Connection connection = dataSource.getConnection()) {
441-
rdbEngine.setReadOnly(connection, true);
441+
rdbEngine.setConnectionToReadOnly(connection, true);
442442

443443
try (PreparedStatement preparedStatement =
444444
connection.prepareStatement(getSelectColumnsStatement())) {
@@ -510,7 +510,7 @@ public TableMetadata getImportTableMetadata(
510510
}
511511

512512
try (Connection connection = dataSource.getConnection()) {
513-
rdbEngine.setReadOnly(connection, true);
513+
rdbEngine.setConnectionToReadOnly(connection, true);
514514

515515
String catalogName = rdbEngine.getCatalogName(namespace);
516516
String schemaName = rdbEngine.getSchemaName(namespace);
@@ -608,7 +608,7 @@ public Set<String> getNamespaceTableNames(String namespace) throws ExecutionExce
608608
+ enclose(METADATA_COL_FULL_TABLE_NAME)
609609
+ " LIKE ?";
610610
try (Connection connection = dataSource.getConnection()) {
611-
rdbEngine.setReadOnly(connection, true);
611+
rdbEngine.setConnectionToReadOnly(connection, true);
612612

613613
try (PreparedStatement preparedStatement =
614614
connection.prepareStatement(selectTablesOfNamespaceStatement)) {
@@ -644,7 +644,7 @@ public boolean namespaceExists(String namespace) throws ExecutionException {
644644
+ enclose(NAMESPACE_COL_NAMESPACE_NAME)
645645
+ " = ?";
646646
try (Connection connection = dataSource.getConnection()) {
647-
rdbEngine.setReadOnly(connection, true);
647+
rdbEngine.setConnectionToReadOnly(connection, true);
648648

649649
try (PreparedStatement statement = connection.prepareStatement(selectQuery)) {
650650
statement.setString(1, namespace);
@@ -992,7 +992,7 @@ private String encloseFullTableName(String schema, String table) {
992992
@Override
993993
public Set<String> getNamespaceNames() throws ExecutionException {
994994
try (Connection connection = dataSource.getConnection()) {
995-
rdbEngine.setReadOnly(connection, true);
995+
rdbEngine.setConnectionToReadOnly(connection, true);
996996

997997
String selectQuery =
998998
"SELECT * FROM " + encloseFullTableName(metadataSchema, NAMESPACES_TABLE);

core/src/main/java/com/scalar/db/storage/jdbc/JdbcDatabase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public Optional<Result> get(Get get) throws ExecutionException {
8282
Connection connection = null;
8383
try {
8484
connection = dataSource.getConnection();
85-
rdbEngine.setReadOnly(connection, true);
85+
rdbEngine.setConnectionToReadOnly(connection, true);
8686
return jdbcService.get(get, connection);
8787
} catch (SQLException e) {
8888
throw new ExecutionException(
@@ -98,7 +98,7 @@ public Scanner scan(Scan scan) throws ExecutionException {
9898
Connection connection = null;
9999
try {
100100
connection = dataSource.getConnection();
101-
rdbEngine.setReadOnly(connection, true);
101+
rdbEngine.setConnectionToReadOnly(connection, true);
102102
return jdbcService.getScanner(scan, connection);
103103
} catch (SQLException e) {
104104
close(connection);

core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineSqlite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public RdbEngineTimeTypeStrategy<Integer, Long, Long, Long> getTimeTypeStrategy(
340340
}
341341

342342
@Override
343-
public void setReadOnly(Connection connection, boolean readOnly) {
343+
public void setConnectionToReadOnly(Connection connection, boolean readOnly) {
344344
// Do nothing. SQLite does not support read-only mode.
345345
}
346346
}

core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ default void throwIfDuplicatedIndexWarning(SQLWarning warning) throws SQLExcepti
230230
// Do nothing
231231
}
232232

233-
default void setReadOnly(Connection connection, boolean readOnly) throws SQLException {
233+
default void setConnectionToReadOnly(Connection connection, boolean readOnly)
234+
throws SQLException {
234235
connection.setReadOnly(readOnly);
235236
}
236237
}

core/src/main/java/com/scalar/db/transaction/jdbc/JdbcTransactionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private DistributedTransaction begin(String txId, boolean readOnly) throws Trans
117117

118118
DistributedTransaction transaction;
119119
if (readOnly) {
120-
rdbEngine.setReadOnly(connection, true);
120+
rdbEngine.setConnectionToReadOnly(connection, true);
121121
transaction =
122122
new ReadOnlyDistributedTransaction(
123123
new JdbcTransaction(txId, jdbcService, connection, rdbEngine));

0 commit comments

Comments
 (0)