Github user sandhyasun commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/363#discussion_r55418965
--- Diff: core/sql/exp/ExpLOB.cpp ---
@@ -186,13 +173,114 @@ Lng32 ExpLOBoper::createLOB(void * lobGlob, void *
lobHeap,
else
lobGlobL = lobGlob;
- rc = ExpLOBinterfaceCreate(lobGlobL, lobName, lobLoc,
Lob_HDFS_File,(char *)"default",lobMaxSize);
+ rc = ExpLOBinterfaceCreate(lobGlobL, lobName, lobLoc,
Lob_HDFS_File,hdfsServer,lobMaxSize, hdfsPort);
+
+ return rc;
+}
+void ExpLOBoper::calculateNewOffsets(ExLobInMemoryDescChunksEntry
*dcArray, Lng32 numEntries)
+{
+ Int32 i = 0;
+ //Check if there is a hole right up front for the first entry. If so
start compacting with the first entry.
+ if (dcArray[0].getCurrentOffset() != 0)
+ {
+ dcArray[0].setNewOffset(0);
+ for (i = 1; i < numEntries; i++)
+ {
+ dcArray[i].setNewOffset(dcArray[i-1].getNewOffset() +
dcArray[i-1].getChunkLen());
+ }
+ }
+ else
+ //Look for the first unused section and start compacting from there.
+ {
+ NABoolean done = FALSE;
+ i = 0;
+ Int32 j = 0;
+ while (i < numEntries && !done )
+ {
+ if ((dcArray[i].getCurrentOffset()+dcArray[i].getChunkLen()) !=
+ dcArray[i+1].getCurrentOffset())
+ {
+ j = i+1;
+ while (j < numEntries)
+ {
+
dcArray[j].setNewOffset(dcArray[j-1].getNewOffset()+dcArray[j-1].getChunkLen());
+ j++;
+ }
+ done = TRUE;
+ }
+ i++;
+ }
+ }
+ return ;
+}
+
+Lng32 ExpLOBoper::compactLobDataFile(void
*lobGlob,ExLobInMemoryDescChunksEntry *dcArray,Int32 numEntries,char
*tgtLobName,Int64 lobMaxChunkMemSize, void *lobHeap, char *hdfsServer, Int32
hdfsPort, char *lobLoc)
+{
+ Int32 rc = 0;
+ void * lobGlobL = NULL;
+ // Call ExeLOBinterface to create the LOB
+ if (lobGlob == NULL)
+ {
+ rc = initLOBglobal(lobGlobL, lobHeap);
+ if (rc)
+ return -1;
+ }
+ else
+ lobGlobL = lobGlob;
+
+ if (rc)
+ return -1;
+
+ rc = ExpLOBinterfacePerformGC(lobGlobL,tgtLobName, (void *)dcArray,
numEntries,hdfsServer,hdfsPort,lobLoc,lobMaxChunkMemSize);
+
+ return rc;
+}
+
+Int32 ExpLOBoper::restoreLobDataFile(void *lobGlob, char *lobName, void
*lobHeap, char *hdfsServer, Int32 hdfsPort, char *lobLoc)
+{
+ Int32 rc = 0;
+ void * lobGlobL = NULL;
+ if (lobGlob == NULL)
+ {
+ rc = initLOBglobal(lobGlobL, lobHeap);
+ if (rc)
+ return -1;
+ }
+ else
+ lobGlobL = lobGlob;
+ rc = initLOBglobal(lobGlobL, lobHeap);
--- End diff --
You found a defect. The if is needed and we cannot call initLOBglobal if
lobGlob was passed in. Correcting that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---