ravipesala commented on a change in pull request #3322: [WIP]Fixed NPE in 
Concurrent query
URL: https://github.com/apache/carbondata/pull/3322#discussion_r302051824
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java
 ##########
 @@ -106,14 +111,16 @@ public int addSegmentProperties(CarbonTable carbonTable,
     SegmentIdAndSegmentPropertiesIndexWrapper segmentIdSetAndIndexWrapper =
         this.segmentPropWrapperToSegmentSetMap.get(segmentPropertiesWrapper);
     if (null == segmentIdSetAndIndexWrapper) {
-      synchronized 
(getOrCreateTableLock(carbonTable.getAbsoluteTableIdentifier())) {
+      synchronized (getOrCreateTableLock(
+          segmentPropertiesWrapper.carbonTable.getAbsoluteTableIdentifier())) {
         segmentIdSetAndIndexWrapper =
             
this.segmentPropWrapperToSegmentSetMap.get(segmentPropertiesWrapper);
         if (null == segmentIdSetAndIndexWrapper) {
           // create new segmentProperties
           segmentPropertiesWrapper.initSegmentProperties();
           segmentPropertiesWrapper.addMinMaxColumns(carbonTable);
           int segmentPropertiesIndex = 
segmentPropertiesIndexCounter.incrementAndGet();
+          
updateDeleteMap(segmentIdSetAndIndexWrapper.getSegmentPropertiesIndex(), -1);
 
 Review comment:
   Is it needed to add -1 while adding? I feel it is better  we can add only 
when invalidate request comes. Otherwise each time iterating cost increases if 
the map grows.

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