kfaraz commented on code in PR #14639:
URL: https://github.com/apache/druid/pull/14639#discussion_r1271235640


##########
server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:
##########
@@ -1760,8 +1761,22 @@ public void updateSegmentMetadata(final Set<DataSegment> 
segments)
           @Override
           public Void inTransaction(Handle handle, TransactionStatus 
transactionStatus) throws Exception
           {
+            final String updatePayload = StringUtils.format("UPDATE %s SET 
payload = :payload WHERE id = :id", dbTables.getSegmentsTable());
+            final PreparedBatch batch = handle.prepareBatch(updatePayload);
+
             for (final DataSegment segment : segments) {
-              updatePayload(handle, segment);
+              String id = segment.getId().toString();
+              byte[] payload = jsonMapper.writeValueAsBytes(segment);
+
+              batch.bind("id", id).bind("payload", payload).add();
+            }
+
+            try {
+              batch.execute();
+            }
+            catch (DBIException e) {
+              log.error(e, "Exception inserting into DB");

Review Comment:
   Would be nice to also mention the datasource and number of segments we were 
trying to update in this log message.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to