Hey, a segment is stuck in "Updating" state after ...
# troubleshooting
t
Hey, a segment is stuck in "Updating" state after server restart. Reloading segments doesn't help. What could be the problem?
{
"segment.realtime.numReplicas": "1",
"segment.creation.time": "1731868179678",
"segment.flush.threshold.size": "100000",
"segment.realtime.startOffset": "0",
"segment.realtime.status": *"IN_PROGRESS"*
}
I'm also confused as to when segments get "persisted" on the filesystem itself. https://docs.pinot.apache.org/release-0.4.0/developers/tutorials/store-data States that by default Pinot offers no inherent storage. Segments are stored only in-memory (?) Explains why they are lost when I restart the server. I would like to store them in the filesystem itself - is it not possible out-of-the-box? Note: Pinot runs on docker.
m
Segments on stored in servers’ disks for fast query and on deep-store for durability. Have you configured deep-store? Check the server log with segment name to see why it is stuck
t
Server log is clean. Logging on INFO level at the moment. Setting it to DEBUG via swagger endpoint didn't seem to bring up any. Trying different logging endpoints seem to throw http 500.
Copy code
"Root directory doesn't exist"
I don't know what the "root directory" is in this context. One example was: "/loggers/instances" endpoint (that requires no params) that did that. But coming back to the original error - this was in the Controller log:
ERROR [CompletionServiceHelper] [grizzly-http-server-5] Connection error . Details: org.apache.pinot.shaded.org.apache.http.conn.HttpHostConnectException: Connect to 172.27.0.6:*8097* [/172.27.0.6] failed: Connection refused
This comes up every time I refresh the UI with segment stuck in "Updating" state, on Segment or Table page. I don't have port 8097 allocated in Docker 🤔 Port 8097 leads me to this article: https://docs.pinot.apache.org/developers/advanced/advanced-pinot-setup#pinot-server "Port for Pinot Server Admin UI", but the UI is running fine. What is this admin ui? Moreover, when the segment is in "Updating" state, no subsequent "insert query" works - data is not added to the "table"/ segment. This is just local development in Docker atm.
x
this error means your server is not able to create the segment for consuming.
This
Root directory doesn't exist
issue is for log aggregation. So you haven’t configure the log directory, which you could specified in each component config files: You need to configure the log file directory first on the log4j2.xml file then configure those: controller:
Copy code
pinot.controller.logger.root.dir=xxxx
broker:
Copy code
pinot.broker.logger.root.dir=xxxx
server:
Copy code
pinot.server.logger.root.dir=xxxx
minion:
Copy code
pinot.minion.logger.root.dir=xxxx
After that you could check log files through controller API.
can you tail the server log and create the table to capture any potential error logs in server? my hypnosis is that your server has no access to the kafka.
Also just enter into server container to check log files instead of docker stdout
t
This "segment stuck in updating" problem happens after I restart the controller, server, broker, zk docker containers. Upon startup I see broker and server with "Dead" status and new instances spawned with "Alive" status. And then the segment stuck in "Updating" status. When I create a new schema and table, with same kafka topic, the segment created in the new table has all my data, no errors and is available for queries. This is the only error I see:
ERROR [CompletionServiceHelper] [grizzly-http-server-3] Connection error  in *'get segment size info from servers'*. Details: org.apache.pinot.shaded.org.apache.http.conn.HttpHostConnectException: Connect to 172.27.0.4:8097 [/172.27.0.4] failed: Connection refused
Interestingly, I am able to remove the segment via UI, the table status is now "Good" - but without segments. Sending a message to kafka now gets ingested into the second table/ segment (the one I created after the first one was updating) - which is correct. But isn't added to the first (original) table/ segment. First and second table both have a matching kafka topic. I was hoping both tables/ segments would consume the message. If a table doesn't have a segment, it won't create one on the fly, upon ingestion?
I have added Pino configuration to point to data folders and appropriate volumes on docker containers. Maybe something important still gets wiped during container restart 🤔 What I'm trying to achieve in general: • Get Kafka + Pinot containers running ✅ • Restarting containers should not delete data - I want to persist them locally, on the same machine, at first; and in the future backed up in s3 deep-store.
m
As long as ZK (contains metadata) and deepstore (contains data) are not shutdown, you can restart Pinot containers without losing data
x
did you changed you network environment and got new IP address?
if so please try out hostname instead of ip
t
I'm not using IP addresses directly. Containers are in their own docker network
x
after you restart, have you seen new brokers/servers join the cluster?
what’s the hostname or ips?
t
Correct, after restarting services (controller, broker, server). they get added to the correct Cluster. From screenshot, see top right - "PinotCluster". Also see table for IP-s.
The statuses are also correctly assigned
It's just the tables and segments get stuck in "Updating" status
I may be wrong, but aren't segments stored in memory first and then after n time or if "buffer size" over limit, they get persisted to local storage; and then to deep-storage if setup?
So when I have a segment with some data, that is fresh; and I restart services, they just get destroyed, since it hadn't satisfied the flush condition yet
idk 🙂
nope, that's not the case. The segments apparently get saved, because when I create another table and start ingesting data - via same kafka topic - the previous data gets picked up! The original segment is still in "udpating" state, but at least I know the data doesn't get wiped... ugh why is it stuck "Updating", that I don't know.
aha, it's trying to get the segment info from a previous, DEAD server
So the culprit was admin port. I was not exposing it from Docker nor did I have it in Server configuration. This isn't well documented here and it's #1 result in Google, related to Pinot + Docker setup https://docs.pinot.apache.org/basics/getting-started/running-pinot-in-docker
ports:
- "8098:8098" # Query port
- "8097:8097" # Admin port
and
pinot.server.port=8098  # Query port
pinot.server.admin.port=8097  # Admin port
Note: everything was actually fine, as long as there were no container restarts. I'm glad I got to test this behavior and get it out of the way - rather test and blow up containers 100x in localhost than in prod 🙂
But even then, restarting a kafka container will still kill your segment's data. So another thing to add is a volume to the kafka container:
volumes:
- ./pinot-data/kafka:/bitnami/kafka"
And only NOW, when I kill my containers, all of them, the data will stay persisted and segments in a correct state. Even after server/ container restarts.
What a journey, lol
m
I am not sure I follow this:
restarting a kafka container will still kill your segment's data.
t
from chatgpt 😄 so segments aren't hard deleted per say, but things get weird when kafka doesn't store its state
x
I think it’s the problem of your local docker setup. You need to assign a container name instead of using ip. The so called restart is actually a running instance dead and a new empty instance joined the cluster. Since Pinot is a stateful system, it cannot tell if the dead instance is coming back or not.
m
Also, Kafka and Pinot are independent systems. Restarting Kafka cannot have any destructive operation (eg kill segments) on Pinot.
x
For docker local, try to start with docker compose and give each container a name for the dns resolution
t
I used an incorrect word, as I said later, segments weren't actually deleted, but not displayed in UI, which was confusing
I'm using docker-compose, all services listed with their respective host names, no direct IP is defined there
As I mentioned, everything works now, after I set those volumes and admin port
State is beautifully persisted now. So however I restart my services, they all get found in the cluster and everything keeps working 🙂
Thank you for the support!
x
ah, good to hear. I found it’s hard to use docker-compose for local test, I will take some time for that experience as well.