Hi Team, We are facing an issue where some segment...
# troubleshooting
r
Hi Team, We are facing an issue where some segments are going into error state intermittently (only some, not all). Here are the pinot-server logs for one such segment (serviceCallView__7__18148__20250227T0907Z) . We are using nfs backed pvc for both server storage and deepstore. From what I am reading from the stacktrace, i see the segment is changing from consuming to online and trying to download the segment from the deepstore -> deleting segment dir if it exists. From limited understanding, when the segment is in consuming state, this directory does not exist /var/pinot/server/data/index/backendEntityView_REALTIME/ and it gets created white committing, correct? Does anyone have insights on this or any idea on what could be happening here? Appreciate the help.
Copy code
2025-02-27 10:07:39.322 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock acquired. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@2e399480[Locked by thread serviceCallView__7__18148__20250227T0907Z]], owner: [serviceCallView__7__18148__20250227T0907Z], holding count: 1
2025-02-27 10:07:39.667 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.c.d.m.r.RealtimeTableDataManager] - semaphore released. sem``aphore: [Semaphore@29c4f125[_partitionGroupId=7, _owner='null', available permits=1]]
2025-02-27 10:07:58.276 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock released. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@2e399480[Unlocked]], owner: [null], holding count: 0

2025-02-27 10:19:20.878 [ERROR] [HelixTaskExecutor-message_handle_STATE_TRANSITION] [o.a.h.m.h.HelixStateTransitionHandler] - Exception while executing a state transition task backendEntityView__4__18555__20250227T0919Z
java.lang.reflect.InvocationTargetException: null
	at jdk.internal.reflect.GeneratedMethodAccessor505.invoke(Unknown Source) ~[?:?]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
	at org.apache.helix.messaging.handling.HelixStateTransitionHandler.invoke(HelixStateTransitionHandler.java:350) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.helix.messaging.handling.HelixStateTransitionHandler.handleMessage(HelixStateTransitionHandler.java:278) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.helix.messaging.handling.HelixTask.call(HelixTask.java:97) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.helix.messaging.handling.HelixTask.call(HelixTask.java:49) [pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
	at java.base/java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.nio.file.DirectoryNotEmptyException: /var/pinot/server/data/index/backendEntityView_REALTIME/backendEntityView__4__18555__20250227T0919Z
	at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(Unknown Source) ~[?:?]
	at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source) ~[?:?]
	at java.base/java.nio.file.Files.delete(Unknown Source) ~[?:?]
	at org.apache.commons.io.FileUtils.delete(FileUtils.java:1222) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1242) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.moveSegment(BaseTableDataManager.java:848) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.downloadSegmentFromDeepStore(BaseTableDataManager.java:785) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.downloadSegment(BaseTableDataManager.java:730) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.downloadAndLoadSegment(BaseTableDataManager.java:389) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.replaceSegmentIfCrcMismatch(BaseTableDataManager.java:380) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.realtime.RealtimeTableDataManager.doAddOnlineSegment(RealtimeTableDataManager.java:428) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.core.data.manager.BaseTableDataManager.addOnlineSegment(BaseTableDataManager.java:313) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.server.starter.helix.HelixInstanceDataManager.addOnlineSegment(HelixInstanceDataManager.java:275) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	at org.apache.pinot.server.starter.helix.SegmentOnlineOfflineStateModelFactory$SegmentOnlineOfflineStateModel.onBecomeOnlineFromConsuming(SegmentOnlineOfflineStateModelFactory.java:88) ~[pinot-all-1.2.0-jar-with-dependencies.jar:1.2.0-5f154102f2b20f8ad9914631f094f6abc1fa1707]
	... 11 more
y
@Xiaobing this looks like the race condition bug you fixed in https://github.com/apache/pinot/pull/14179 right?
@Revanth are you using upserts on this table?
r
No, we are not using upserts. Adding table config for reference.
Copy code
{
  "REALTIME": {
    "tableName": "serviceCallView_REALTIME",
    "tableType": "REALTIME",
    "segmentsConfig": {
      "timeColumnName": "start_time_millis",
      "segmentPushType": "APPEND",
      "timeType": "MILLISECONDS",
      "retentionTimeUnit": "DAYS",
      "retentionTimeValue": "8",
      "minimizeDataMovement": false,
      "replicasPerPartition": "1",
      "replication": "1",
      "deletedSegmentsRetentionPeriod": "1d"
    },
    "tenants": {
      "broker": "DefaultTenant",
      "server": "DefaultTenant"
    },
    "tableIndexConfig": {
      "streamConfigs": {
        "realtime.segment.flush.threshold.rows": "0",
        "realtime.segment.serverUploadToDeepStore": "false",
        "group.id": "serviceCallView",
        "stream.kafka.hlc.zk.connect.string": "zookeeper:2181",
        "stream.kafka.decoder.class.name": "org.apache.pinot.plugin.inputformat.avro.confluent.KafkaConfluentSchemaRegistryAvroMessageDecoder",
        "streamType": "kafka",
        "stream.kafka.decoder.prop.schema.registry.rest.url": "http://schema-registry-service:8081",
        "stream.kafka.consumer.type": "LowLevel",
        "realtime.segment.flush.threshold.segment.size": "512M",
        "stream.kafka.broker.list": "bootstrap:9092",
        "realtime.segment.flush.threshold.time": "6h",
        "stream.kafka.zk.broker.url": "zookeeper:2181",
        "stream.kafka.consumer.factory.class.name": "org.apache.pinot.plugin.stream.kafka20.KafkaConsumerFactory",
        "stream.kafka.consumer.prop.auto.offset.reset": "largest",
        "stream.kafka.topic.name": "service-call-view-events"
      },
      "aggregateMetrics": false,
      "starTreeIndexConfigs": [
        {
          "dimensionsSplitOrder": [
            "customer_id",
            "callee_environment",
            "caller_environment",
            "callee_service_id_str",
            "caller_service_id_str",
            "callee_api_id_str",
            "caller_api_id_str",
            "callee_backend_id",
            "callee_backend_api_id"
          ],
          "functionColumnPairs": [
            "COUNT__trace_id",
            "AVG__num_calls",
            "SUM__num_calls",
            "AVG__error_count",
            "SUM__error_count",
            "PERCENTILE_TDIGEST__duration_millis"
          ],
          "maxLeafRecords": 10000
        }
      ],
      "enableDefaultStarTree": false,
      "nullHandlingEnabled": false,
      "noDictionaryColumns": [],
      "bloomFilterColumns": [],
      "invertedIndexColumns": [
        "caller_environment",
        "callee_environment",
        "caller_service",
        "caller_service_id_str",
        "caller_api",
        "caller_api_id_str",
        "callee_service",
        "callee_service_id_str",
        "callee_api",
        "callee_api_id_str",
        "callee_backend_id"
      ],
      "rangeIndexColumns": [
        "start_time_millis"
      ],
      "sortedColumn": [
        "customer_id"
      ],
      "createInvertedIndexDuringSegmentGeneration": false,
      "rangeIndexVersion": 2,
      "optimizeDictionary": false,
      "loadMode": "MMAP",
      "optimizeDictionaryForMetrics": false,
      "autoGeneratedInvertedIndex": false,
      "enableDynamicStarTreeCreation": false,
      "columnMajorSegmentBuilderEnabled": true,
      "noDictionarySizeRatioThreshold": 0
    },
    "metadata": {},
    "routing": {
      "segmentPrunerTypes": [
        "time"
      ],
      "useFixedReplica": false
    },
    "ingestionConfig": {
      "continueOnError": false,
      "rowTimeValueCheck": false,
      "segmentTimeValueCheck": true
    },
    "isDimTable": false
  }
}
pinot-server-1
Copy code
pinot-server-1__pinot-server.log:2025-02-27 10:07:39.322 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock acquired. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@2e399480[Locked by thread serviceCallView__7__18148__20250227T0907Z]], owner: [serviceCallView__7__18148__20250227T0907Z], holding count: 1
pinot-server-1__pinot-server.log:2025-02-27 10:07:39.667 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.c.d.m.r.RealtimeTableDataManager] - semaphore released. sem``aphore: [Semaphore@29c4f125[_partitionGroupId=7, _owner='null', available permits=1]]
pinot-server-1__pinot-server.log:2025-02-27 10:07:58.276 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock released. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@2e399480[Unlocked]], owner: [null], holding count: 0
pinot-server-1__pinot-server.log:2025-02-27 10:07:59.181 [ERROR] [HelixTaskExecutor-message_handle_STATE_TRANSITION] [o.a.h.m.h.HelixStateTransitionHandler] - Exception while executing a state transition task serviceCallView__7__18148__20250227T0907Z
pinot-server-1__pinot-server.log:Caused by: java.nio.file.DirectoryNotEmptyException: /var/pinot/server/data/index/serviceCallView_REALTIME/serviceCallView__7__18148__20250227T0907Z
pinot-server-2
Copy code
pinot-server-2__pinot-server.log:2025-02-27 10:07:27.420 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock acquired. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@7e7e471c[Locked by thread serviceCallView__7__18148__20250227T0907Z]], owner: [serviceCallView__7__18148__20250227T0907Z], holding count: 1
pinot-server-2__pinot-server.log:2025-02-27 10:07:31.869 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.c.d.m.r.RealtimeTableDataManager] - semaphore released. sem``aphore: [Semaphore@5cbf67ed[_partitionGroupId=7, _owner='null', available permits=1]]
pinot-server-2__pinot-server.log:2025-02-27 10:07:39.495 [DEBUG] [serviceCallView__7__18148__20250227T0907Z] [o.a.p.s.l.u.SegmentLocks] - lock released. lock: [org.apache.pinot.segment.local.utils.SegmentLocks$TrackableReentrantLock@7e7e471c[Locked by thread HelixTaskExecutor-message_handle_STATE_TRANSITION]], owner: [null], holding count: 0
just sharing the logs for this segment from pinot server 1 and pinot server 2 (replication is 2). The issue is happening for the segment in sever 1.
x
... We are using nfs backed pvc for both server storage and deepstore
since it's nfs for servers, I wonder if the two servers (replica=2) happened to overwrite each other?
r
each server has a dedicated directory for local storage
there could be something about the nfs server which is causing this but I am not unable to understand at what exact point it's going wrong. the delete call attempted to delete columns.psf and star_tree_index while they were still open by pinot-server itself and hence nfs left them in place as .nfs files (some context on .nfs file: https://unix.stackexchange.com/a/348678) really appreciate if you can share some info on the sequence of events leading to the error
here is the lsof output of pinot-server still having these files open
Copy code
java    1354766 root  mem       REG  0,194             8066638 /var/pinot/server/data/index/serviceCallView_REALTIME/serviceCallView__7__18148__20250227T0907Z/v3/.nfs00000000007b164e0003966b (stat: No such file or directory)
java    1354766 root  mem       REG  0,194             7570880 /var/pinot/server/data/index/serviceCallView_REALTIME/serviceCallView__7__18148__20250227T0907Z/v3/.nfs00000000007385c00003966c (stat: No such file or directory)