Inconsistency in num tuples on table


#1

Hi, @easy i got some trouble at my table,suddenly it can’t be query and i got this error Exception: Exception occurred: java.lang.RuntimeException: TMapDException(error_msg:Inconsistency in num tuples within fragment)
is there a way to repair my table?
thanks :slight_smile:


#2

@rejanuiss I can see that you checked a few other posts on this topic. I’d recommend finding the error in the log and sending that snippet so we can check it out.


#3

Hi @easy, sorry for late replies here is my log . and my table who got error cannot be drop!mapd_server.desktop.mapd.log.ERROR.20180708-230602.1181.zip (1.1 KB)


#4

try a truncate table beforce drop


#5

hi @aznable sorry for late replies, i 'm still got same error
image


#6

dont worry, i got some locking problem some time ago, and i had to do a truncate before to be able to drop the tables; anyway was a silly suggestion :wink:


#7

is there another way, to solve this haha, cause that’s table have 100 thousands data,.


#8

Hi,

Don’t want to promise we can solve your issue without having more details but there are a couple of things you can try.

There are two undocumented command in mapdql

\gte <table_name> get table epoch for the specified table
\ste "<table_name new_epoch>" set table epoch for the specified table to specified epoch (NOTE the extra " they are mandatory)

Basically there are little to no guard rails around the \ste command, once you set the epoch on a table to a previous epoch your newer data is gone.

Each time an insert or COPY statement writes data to a table the epoch value increases.

Simple example

mapdql> create table testtable (i1 int);
mapdql> \gte testtable
table epoch is 0
mapdql> insert into testtable values (10);
mapdql> \gte testtable
table epoch is 1
mapdql> insert into testtable values (20);
mapdql> \gte testtable
table epoch is 2
mapdql> insert into testtable values (30);
mapdql> select * from testtable;
i1
10
20
30
mapdql> \gte testtable
table epoch is 3
mapdql> \ste "testtable 2"
table epoch set
mapdql> select * from testtable;
i1
10
20
mapdql> 

So in your case first you would try a \gte yourtable

if you can determine the current epoch you would then progressively set the epoch to the current value minus 1 until you found you had a working table (to check this run simple query on the table).

Now the likely case is you will not be able to do the simple \gte yourtable as it may well fail with the same tuple inconsistency

If this is the case there is another form of the command that use a tableid format to specify how to step back through the epochs.

Please try the above steps and if they fail, which is likely please include the full log so we can determine the appropriate tableid values for the next option

Regards