shanthoosh commented on a change in pull request #1125: SAMZA-2286: Integrate 
MetadataStore#putAll for improved startup time.
URL: https://github.com/apache/samza/pull/1125#discussion_r317416413
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/storage/ChangelogStreamManager.java
 ##########
 @@ -90,18 +90,23 @@ public ChangelogStreamManager(MetadataStore metadataStore) 
{
    */
   public void writePartitionMapping(Map<TaskName, Integer> changelogEntries) {
     LOG.debug("Updating changelog information with: ");
+    HashMap<String, byte[]> changelogEntriesToStore = new HashMap<>();
     for (Map.Entry<TaskName, Integer> entry : changelogEntries.entrySet()) {
       Preconditions.checkNotNull(entry.getKey());
       String taskName = entry.getKey().getTaskName();
       if (entry.getValue() != null) {
         String changeLogPartitionId = String.valueOf(entry.getValue());
         LOG.debug("TaskName: {} to Partition: {}", taskName, entry.getValue());
-        metadataStore.put(taskName, valueSerde.toBytes(changeLogPartitionId));
+        changelogEntriesToStore.put(taskName, 
valueSerde.toBytes(changeLogPartitionId));
       } else {
         LOG.debug("Deleting the TaskName: {}", taskName);
         metadataStore.delete(taskName);
 
 Review comment:
   Not related to this change. But it would be beneficial to add a deleteAll  
API in `MetadataStore` (synonymous to putAll API). `deleteAll` API would 
simplify the iterative delete API invocations. If you agree, then it would be 
great to create a follow-up ticket and add a todo 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:
[email protected]


With regards,
Apache Git Services

Reply via email to