Forum: Building VoltDB Applications

Post: Mispartitioned Tuple in single-partition plan.

Mispartitioned Tuple in single-partition plan.
shetty_ritesh
May 7, 2010
Hi Tim

I uploaded around 5 million records into a table sucessfully in a single node single partition enviorment.
I setup the clustered node and it gave following error
[
java] [ERROR] [../../src/ee/executors/insertexecutor.cpp:158:p_execute()] 2010-05-07 12:45:59 - Mispartitioned Tuple in single-partition plan.

The table has single partiion

Subject table
@ProcInfo(partitionInfo = "TABLE1.COLUMN1 0", singlePartition = true)

I tested this for

1>Mutiple nodes single partion on the server --->> Doesnt work
2>Mutiple nodes mutiple partition on the server -->> doesnt work
3>Single node single partition -->> works

Regards
Ritesh
re: Mispartitioned Tuple in single-partition plan.
tcallaghan
May 10, 2010
Ritesh,

I believe this is similar to your other post. If your single-partition stored procedures need to operate on data with more than one partitioned table then you need to partition on the same column in all participating tables.

Please see this post for more information.

-Tim
Tim, This case is
shetty_ritesh
May 10, 2010
Ritesh,

I believe this is similar to your other post. If your single-partition stored procedures need to operate on data with more than one partitioned table then you need to partition on the same column in all participating tables.

Please see this post for more information.

-Tim

Tim,

This case is different.
I have just 1 table which i populate with many records. The inserts work fine in single node single partition.
the moment i turn ON the second node i start getting these errors. So its the inserts that are failing in this case.

Regards
Ritesh
re: Mispartitioned Tuple in single-partition plan.
tcallaghan
May 11, 2010
Tim,

This case is different.
I have just 1 table which i populate with many records. The inserts work fine in single node single partition.
the moment i turn ON the second node i start getting these errors. So its the inserts that are failing in this case.

Regards
Ritesh


Ritesh,

I went back and re-reviewed all your code, I can now see the issue.

The table you are inserting into is partitioned on the first column in your DDL, which is type BIGINT. The first parameter (which you have identified as the partitioning parameter) to your "Insert" stored procedure is a String type.

You must change the first parameter to your stored procedure be a long and determine/pass the value to your stored procedure. If you don't, then it is possible for the String you are passing to your stored procedure to hash differently than the underlying long value. When the stored procedure is invoked we are hashing the String to a particular partition. Your stored procedure code is then taking that string and converting it into a long. At that point the insert statement is called with the long, which VoltDB re-hashes to make sure it is in the correct partition (which at this point it may not be).

If you run VoltDB with a single server and single partition you can't end up in the wrong partition. As soon as you have multiple servers and/or multiple partitions per server your code is causing an insert to be sent to one partition when it really needs to be sent to another.

I'll add a ticket to our internal system to see if we can determine this mismatching of types during compilation.

Let me know if this resolves your issue.
-Tim
Thanks Tim, This works fine
shetty_ritesh
May 11, 2010
Ritesh,

I went back and re-reviewed all your code, I can now see the issue.

The table you are inserting into is partitioned on the first column in your DDL, which is type BIGINT. The first parameter (which you have identified as the partitioning parameter) to your "Insert" stored procedure is a String type...

-Tim



Thanks Tim,
This works fine now
Hello World Sample
henning
Aug 5, 2010
In a related note, the Hello World Insert.java should be corrected


from         partitionInfo = "HELLOWORLD.DIALECT: 0",
to           partitionInfo = "HELLOWORLD.DIALECT: 2",



You run into the error message this thread is named for, because of the wrong index (0) to the run method parameter given in the partitionInfo. As Tim writes, it's not creating an issue as long as you stay with a single partition sample. But 'DIALECT' is actually handed over to run() as the 'language' parameter, the 3rd in the call to run (zero base index = 2).

helloworld/Insert.java:


import org.voltdb.*;

@ProcInfo(
    partitionInfo = "HELLOWORLD.DIALECT: 2",
    singlePartition = true
)

public class Insert extends VoltProcedure {

  public final SQLStmt sql = new SQLStmt(
      "INSERT INTO HELLOWORLD VALUES (?, ?, ?);"
  );

  public VoltTable[] run( String hello,
                          String world,
                          String language)
      throws VoltAbortException {
          voltQueueSQL( sql, hello, world, language );
          voltExecuteSQL();
          return null;
      }
}


Henning