Skip to content
Permalink
Browse files
HAWQ-147. Fix a bug of creating database failed due to parquet table …
…exist in template1
  • Loading branch information
ztao1987 committed Jan 26, 2016
1 parent 379cb11 commit 09536846541e09a9595ea7549f8cf516d8b41c00
Showing 1 changed file with 28 additions and 31 deletions.
@@ -1037,7 +1037,7 @@ DatabaseInfo_HandleAppendOnly(
if (dbInfoRel == NULL)
break;

if (dbInfoRel->relstorage == RELSTORAGE_AOROWS)
if (dbInfoRel->relstorage == RELSTORAGE_AOROWS || dbInfoRel->relstorage == RELSTORAGE_PARQUET)
{
AppendOnlyEntry *aoEntry;
DbInfoRel *aosegDbInfoRel;
@@ -1076,38 +1076,35 @@ DatabaseInfo_HandleAppendOnly(
aoEntry->segrelid);
Assert(aosegDbInfoRel != NULL);

if (dbInfoRel->relstorage == RELSTORAGE_AOROWS)
FileSegInfo **aoSegfileArray;
int totalAoSegFiles;

Relation pg_aoseg_rel;

pg_aoseg_rel =
DirectOpen_PgAoSegOpenDynamic(
aoEntry->segrelid,
MyDatabaseTableSpace,
info->database,
aosegDbInfoRel->relfilenodeOid);

aoSegfileArray =
GetAllFileSegInfo_pg_aoseg_rel(
dbInfoRel->relname,
aoEntry,
pg_aoseg_rel,
SnapshotNow,
-1,
&totalAoSegFiles);
for (i = 0; i < totalAoSegFiles; i++)
{
FileSegInfo **aoSegfileArray;
int totalAoSegFiles;

Relation pg_aoseg_rel;

pg_aoseg_rel =
DirectOpen_PgAoSegOpenDynamic(
aoEntry->segrelid,
MyDatabaseTableSpace,
info->database,
aosegDbInfoRel->relfilenodeOid);

aoSegfileArray =
GetAllFileSegInfo_pg_aoseg_rel(
dbInfoRel->relname,
aoEntry,
pg_aoseg_rel,
SnapshotNow,
-1,
&totalAoSegFiles);
for (i = 0; i < totalAoSegFiles; i++)
{
DatabaseInfo_AddAppendOnlyCatalogSegmentInfo(
dbInfoRel,
aoSegfileArray[i]->segno,
aoSegfileArray[i]->eof);
}
DatabaseInfo_AddAppendOnlyCatalogSegmentInfo(
dbInfoRel,
aoSegfileArray[i]->segno,
aoSegfileArray[i]->eof);
}

DirectOpen_PgAoSegClose(pg_aoseg_rel);
}
DirectOpen_PgAoSegClose(pg_aoseg_rel);
}
}
}

0 comments on commit 0953684

Please sign in to comment.