ASF GitHub Bot logged work on BEAM-6627:

                Author: ASF GitHub Bot
            Created on: 03/Dec/19 11:32
            Start Date: 03/Dec/19 11:32
    Worklog Time Spent: 10m 
      Work Description: lgajowy commented on pull request #10267: [BEAM-6627] 
Add size reporting to JdbcIOIT
URL: https://github.com/apache/beam/pull/10267#discussion_r353125227

 File path: 
 @@ -79,6 +80,19 @@ public static String 
getPostgresDBUrl(PostgresIOTestPipelineOptions options) {
+  public static Long getPostgresTableSize(DataSource dataSource, String 
+      throws SQLException {
+    try (Connection connection = dataSource.getConnection()) {
+      try (Statement statement = connection.createStatement()) {
+        ResultSet resultSet =
+            statement.executeQuery(String.format("select 
pg_relation_size('%s')", tableName));
+        if (resultSet.next()) {
+          return resultSet.getLong(1);
+        } else return 0L;
 Review comment:
   It looks that the code returns 0L in case the size is not available (am I 
right?) Maybe we shouldn't return 0L in that case - "else" means in this case 
that "we couldn't retrieve the size" not that it is equal to 0. 
   Have you considered using Optional<Long> here?
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

Issue Time Tracking

    Worklog Id:     (was: 352564)

> Use Metrics API in IO performance tests
> ---------------------------------------
>                 Key: BEAM-6627
>                 URL: https://issues.apache.org/jira/browse/BEAM-6627
>             Project: Beam
>          Issue Type: Improvement
>          Components: testing
>            Reporter: Michal Walenia
>            Assignee: Michal Walenia
>            Priority: Minor
>          Time Spent: 16h 20m
>  Remaining Estimate: 0h

This message was sent by Atlassian Jira

Reply via email to