mcvsubbu commented on a change in pull request #7886:
URL: https://github.com/apache/pinot/pull/7886#discussion_r768249572
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeTableDataManager.java
##########
@@ -340,9 +340,18 @@ public void addSegment(String segmentName, TableConfig
tableConfig, IndexLoading
PartitionUpsertMetadataManager partitionUpsertMetadataManager =
_tableUpsertMetadataManager != null ? _tableUpsertMetadataManager
.getOrCreatePartitionManager(partitionGroupId) : null;
- segmentDataManager =
- new LLRealtimeSegmentDataManager(segmentZKMetadata, tableConfig,
this, _indexDir.getAbsolutePath(),
- indexLoadingConfig, schema, llcSegmentName, semaphore,
_serverMetrics, partitionUpsertMetadataManager);
+ try {
+ segmentDataManager =
+ new LLRealtimeSegmentDataManager(segmentZKMetadata, tableConfig,
this, _indexDir.getAbsolutePath(),
+ indexLoadingConfig, schema, llcSegmentName, semaphore,
_serverMetrics, partitionUpsertMetadataManager);
+ } catch (Exception e) {
+ // In case of exception thrown here, segment goes to ERROR state. Then
any attempt to reset the segment from
+ // ERROR -> OFFLINE -> CONSUMING via Helix Admin fails because the
semaphore never gets released and the
+ // semaphore.acquire() is called in constructor of
LLRealtimeSegmentDataManager. Hence releasing the semaphore
+ // here to unblock reset operation via Helix Admin.
+ semaphore.release();
+ throw e;
Review comment:
Used to be that we never threw exception from this method. All the
interaction with underlying stream was done in the thread that was spawned.
Well, now we like to try to do as much as possible in the state transition so
that it can change to ERROR if we are not able to connect to the stream (for
example). We need to change the semaphore etc. behavior accordingly.
You can move a whole bunch of lines into another method, and put a try/catch
around a call to the method (if you think that gets to be more readable). Maybe
throw specific exception also after catching an overall exception.
--
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]