<#C01RTEQ3FUG|debug_upsert> <#CJG3FPQK0|feat-upser...
# troubleshooting
m
#debug_upsert #feat-upsert Hello team, Version 1.1 Open source One of our clients uses FULL upsert, 2 replicas with completion mode download, and a comparison column as LONG. Note this variable is not DateTimeField Spec but a dimension of type LONG. The problem is we see multiple records returned by the query for the same primary key ID. Few observations are as follows: 1. One replica group gives correct results, but another returns extra records with the correct record. 2. Verified topic key as well, all records are part of the same segment family i.e. same partition. 3. Sometimes incorrect records belong to two different segments one with the older segment & one with the latest segment, other times within the same segment two records are returned. Questions- 1. What are some possible scenarios to happen in such case? 2. If the segment which is being replaced by S3 will it also copy bitmap? 3. How mandatory is it to use comparison column as DateTimeField even though dimension and DateTimeField both format is LONG @Xiang Fu @Mayank
m
1. The most frequent reason is data is not partition on PK upstream. 2. In OSS implementation, S3 does not store the bitmap (afaik) 3. I think it should be fine to use another column type. Can you try to restart the bad replica to see if that resolves the issue?
m
It's in PROD so cannot restart whole server but tried to rebalance the table and somehow this got fixed. (I honestly don't understand how) Partition is correct, as I mentioned all records belongs to same segment family. @Kartik Khare I saw one of your comments in a different post "your ideal state is messed up. segments from same partitions are getting alloted to different servers." Could you please explain this in simple terms? As I understand table with 2 replicas will have segments allocated to two servers, isn't this expected?
@Xiaobing Any idea what could be causing upsert table to return multiple records? Please note I have already verified upstream kafka topic partition, zk ideal and external state.
x
Table partitions and replicas are two things and work pretty much independently. Table partitioning splits a table data into many partitions (duh…). And records with same primary keys are inserted into same partition. Upsert happens at partition level. And upsert table assigns segments in one partition onto one server for upsert to happen correctly. (What Kartik suggested was about this. The ideal state didn’t assign segments correctly. Rebalancing must have fixed this) The table replicas are multiple copies of same data. A table has two replica means it have two full copies of data. Replicas are supposed to be put on different servers for failure tolerance.
What did you mean by same segment family? (Same table partition?) I don’t know how your table ended up into the unexpected ideal state. Was upsert enabled on a table with existing segments?
m
@Xiaobing 1. Upsert was enabled since the table creation. 2. The topic is correctly partitioned from upstream. And both correct and incorrect records belong to the same partition. 3. I have verified the ideal and external state, it's correct, and the partitions belong to the same server. Questions. 1. The upsert comparison column is type LONG (Dimension spec) instead of type LONG (DateTime spec), will this affect? 2. I verified broker logs, the QueryLogger shows when one replica group gave correct results showing number of segments matched as 1 (expected), but the incorrect replica group shows as number of segments matches 2. How can I check this in the source code from where this value comes from. 3. How does resetting the segment helped here? We were able to see correct response from both replica groups Please advise.