Commit 7c32b51c authored by Ivan Donchevskiy's avatar Ivan Donchevskiy

don't delete rows when changing size of CycleStorage to less (bug 4172)

parent 0cd82222
......@@ -257,6 +257,7 @@ bool testJournal1(void)
return false;
}
k = 0;
printf("size changed to 33000 rows (increased)\n");
j.setSize(33000);
TableBlockStorage t("big_file.test", 4, 40, 100, 5,28,0);
printf("test of 2 classes working in 1 file together\n");
......@@ -319,8 +320,9 @@ bool testJournal1(void)
if(!reOpen()) return false;
printf("size changed back to 32000 rows\n");
j.setSize(32000);
for(i=0;i<32000;i++)
for(i=0;i<20;i++)
{
if(j.readRow(i,str))
{
......@@ -328,11 +330,13 @@ bool testJournal1(void)
k++;
}
}
if( k>0 )
if(k != 10)
{
delete str;
return false;
}
k = 0;
delete str;
return true;
}
......
......@@ -408,8 +408,15 @@ bool CycleStorage::setSize(int count)
if(count<size)
{
if( head>count-1 )
{
head = 0;
tail = count - 1;
}
if( tail>count-1 )
tail = count - 1;
size=count;
return delAllRows();
return true;
}
int num = count - size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment