I am not getting correct data after upsert. 2nd r...
# troubleshooting
p
I am not getting correct data after upsert. 2nd row was already there I wanted to update it. But when I sent a new kafka message with same
id
(primary key in schema) and updated
exception_count
and
updated_at
it created a new record (1st row). When querying from Query Console is the the attached results where for the given id. But when I query using the Java client I get on the 1 record i.e. older record whose updated at value 1660654106. *All of the columns in the ss are actual columns. They are not derived.
m
Which version? There have been some recent bug fixes that will be available in 0.11.
p
Screenshot from 2022-08-24 11-19-37.png
@Mayank should we move to upgrading to 0.11?
m
What’s your upsert config
p
Copy code
{
    "mode": "PARTIAL",
    "partialUpsertStrategies": {
        "exception_count": "OVERWRITE",
    },
    "hashFunction": "NONE"
}
m
@Kartik Khare ^^
k
Hi, can you also share the primary key from the schema? Also, was the upsert enabled after inserting the first record?
But when I query using the Java client I get on the 1 record i.e. older record whose updated at value 1660654106.
This is weird. Do you have multi server setup or a single server?
p
1. id is the primary key in the schema. 2. Upsert was enabled before inserting both the records. 3. In the cluster manager I can see 3 servers
k
ok, what I believe that the upsert state in multiple servers is different for some reason. Can you try running the query multiple times in pinot UI and check if you always get same results you can also add $hostName to the queries to check which server the records are coming from
p
I ran query multiple times. Getting same result
can you share the query syntax(any doc would be the best) of adding hostname in the query?
k
Ok. Can you tell me how are you querying using the java client and does it also return the same result? syntax is select id, reference_number, updated_at, $hostName, $segmentName, $docId from table
p
This is the query result.
Copy code
private ResultSet runQuery(String query) {
        Request pinotClientRequest = new Request("sql", query);
        try {
            ResultSetGroup pinotResultSetGroup = pinotConnection.execute(pinotClientRequest);
            return pinotResultSetGroup.getResultSet(0);
        } catch (PinotClientException e) {
            log.error("Query Error, Query:{}", query, e);
            throw GenericExceptionFactory.getGenericException(VisibilityErrorCode.DB_ERROR,
                "DB Query Failed");
        }
    }
Above is the Java Code snippet that we are using. @Kartik Khare
Java Client is only returning old record.
k
No, I meant the creating connection part as well as
query
part as well
s
@Kartik Khare this currently happens to the pinot setup I have. server-1 shows different result compared to server 3. the segments are currently in consuming state.