Skip to content

Commit

Permalink
fix: hint for large copy operations missed 'spanner.' namespace (#304)
Browse files Browse the repository at this point in the history
The hint that was included in the error message that is returned for too
large copy operations did not include the 'spanner.' namespace prefix.
This would break copy-pasting the hint from the error message to a
command console.

Fixes b/240604839
  • Loading branch information
olavloite authored Aug 4, 2022
1 parent e31fd02 commit a5e8afc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public StatementResult call() throws Exception {
+ "plus the number of indexed columns in the record. The maximum number of mutations "
+ "in one transaction is "
+ DEFAULT_MUTATION_LIMIT
+ ".\n\nExecute `SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation "
+ ".\n\nExecute `SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation "
+ "to instruct PGAdapter to automatically break large transactions into multiple smaller. "
+ "This will make the COPY operation non-atomic.\n\n");
}
Expand All @@ -291,7 +291,7 @@ public StatementResult call() throws Exception {
+ currentBufferByteSize
+ " has exceeded the limit: "
+ commitSizeLimit
+ ".\n\nExecute `SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation "
+ ".\n\nExecute `SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation "
+ "to instruct PGAdapter to automatically break large transactions into multiple smaller. "
+ "This will make the COPY operation non-atomic.\n\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void testCopyIn_Large_FailsWhenAtomic() throws Exception {
+ "\n"
+ "The number of mutations per record is equal to the number of columns in the record plus the number of indexed columns in the record. The maximum number of mutations in one transaction is 20000.\n"
+ "\n"
+ "Execute `SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
+ "Execute `SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
exception.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public void testCopyIn_Large_FailsWhenAtomic() throws SQLException {
+ "\n"
+ "The number of mutations per record is equal to the number of columns in the record plus the number of indexed columns in the record. The maximum number of mutations in one transaction is 20000.\n"
+ "\n"
+ "Execute `SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
+ "Execute `SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
exception.getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void testWriteMutations_FailsForLargeBatch() throws Exception {
+ "\n"
+ "The number of mutations per record is equal to the number of columns in the record plus the number of indexed columns in the record. The maximum number of mutations in one transaction is 20000.\n"
+ "\n"
+ "Execute `SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
+ "Execute `SET SPANNER.AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'` before executing a large COPY operation to instruct PGAdapter to automatically break large transactions into multiple smaller. This will make the COPY operation non-atomic.\n\n",
exception.getMessage());

verify(connection, never()).write(anyIterable());
Expand Down

0 comments on commit a5e8afc

Please sign in to comment.