Ejemplo n.º 1
0
        bool Page::deleteObj(long long headerpos)
        {
            //reading the Page
            tasking::RWLockGuard<> lock(m_rwLock, tasking::WRITE);
            auto l_header = reinterpret_cast<HeaderMetaData*>(static_cast<char*>(m_header) + headerpos);
            auto l_oid = l_header->getOID();
            //start delete by calculating the start position and passing the hash of the obj name
            deleteObj(l_header->getObjektType(), static_cast<char*>(m_body) + l_header->getPos());

            //now its delete put the freetype ptr to the start
            //of the "prepared" deleted object
            auto l_free = m_free;
            while (l_free->getNext() == 0)
                l_free = reinterpret_cast<FreeType*>(reinterpret_cast<char*>(l_free) + l_free->getNext());
            // now l_Free is the last element;
            l_free->setNext(dist(l_free, static_cast<char*>(m_body) + l_header->getPos()));

            // Delete header
            l_free = m_headerFree;
            while (l_free->getNext() == 0)
                l_free = reinterpret_cast<FreeType*>(reinterpret_cast<char*>(l_free) + l_free->getNext());

            //now we have the last free element of the header
            //insert free type with the right size
            auto l_deletedHeader = new(l_header) FreeType(sizeof(HeaderMetaData));
            //set the freeType pointer to it
            l_free->setNext(dist(l_free, l_deletedHeader));

            //delete the obj of the idx
            index::ObjectIndex::getInstance().erase(l_oid);
            //do NOT delete the Meta! it is way faster to
            //insert with meta then without so keep the data
            return true;
        }
Ejemplo n.º 2
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__REMOVEV, "_rtnLocalLobStream::_removev" )
   INT32 _rtnLocalLobStream::_removev( const RTN_LOB_TUPLES &tuples,
                                       _pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__REMOVEV ) ;
      dmsLobRecord record ;

      for ( RTN_LOB_TUPLES::const_iterator itr = tuples.begin() ;
            itr != tuples.end() ;
            ++itr )
      {
         record.set( &getOID(),
                     itr->tuple.columns.sequence,
                     itr->tuple.columns.offset,
                     itr->tuple.columns.len,
                     itr->data ) ;
         rc = _su->lob()->remove( record, _mbContext, cb,
                                  _getDPSCB() ) ;
         if ( SDB_OK != rc )
         {
            PD_LOG( PDERROR, "failed to remove lob[%s],"
                    "sequence:%d, rc:%d", record._oid->str().c_str(),
                    record._sequence, rc ) ;
            goto error ;
         }
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__REMOVEV, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 3
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__ROLLBACK, "_rtnLocalLobStream::_rooback" )
   INT32 _rtnLocalLobStream::_rollback( _pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__ROLLBACK ) ;
      dmsLobRecord piece ;
      INT32 num = _getSequence( curOffset() ) ;

      while ( 0 < num )
      {
         --num ;
         piece.set( &getOID(), num, 0, 0, NULL ) ;
         rc = _su->lob()->remove( piece, _mbContext, cb,
                                  _getDPSCB() ) ;
         if ( SDB_OK != rc )
         {
            PD_LOG( PDERROR, "Failed to remove lob[%s],"
                    "sequence:%d, rc:%d", piece._oid->str().c_str(),
                    piece._sequence, rc ) ;
            if ( SDB_LOB_SEQUENCE_NOT_EXIST != rc )
            {
               goto error ;
            }
            rc = SDB_OK ;
         }
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__ROLLBACK, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 4
0
   INT32 _rtnLocalLobStream::_read( const _rtnLobTuple &tuple,
                                    _pmdEDUCB *cb,
                                    CHAR *buf )
   {
      INT32 rc = SDB_OK ;
      UINT32 len = 0 ;
      dmsLobRecord record ;
      record.set( &getOID(),
                  tuple.tuple.columns.sequence,
                  tuple.tuple.columns.offset,
                  tuple.tuple.columns.len,
                  tuple.data ) ;
      rc = _su->lob()->read( record, _mbContext, cb,
                             buf, len ) ;
      if ( SDB_OK != rc )
      {
         PD_LOG( PDERROR, "failed to read lob[%s], sequence[%d], rc:%d",
                 record._oid->str().c_str(), record._sequence, rc ) ;
         goto error ;
      }

      SDB_ASSERT( len == record._dataLen, "impossible" ) ;
   done:
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 5
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__ENSURELOB, "_rtnLocalLobStream::_ensureLob" )
   INT32 _rtnLocalLobStream::_ensureLob( _pmdEDUCB *cb,
                                         _dmsLobMeta &meta,
                                         BOOLEAN &isNew )
   {
      INT32 rc = SDB_OK ;
      _dmsLobMeta tmpMeta ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__ENSURELOB ) ;

      rc = _su->lob()->getLobMeta( getOID(), _mbContext,
                                   cb, tmpMeta ) ;
      if ( SDB_OK == rc )
      {
         if ( !tmpMeta.isDone() )
         {
            PD_LOG( PDINFO, "Lob[%s] meta[%s] is not available",
                    getOID().str().c_str(), tmpMeta.toString().c_str() ) ;
            rc = SDB_LOB_IS_NOT_AVAILABLE ;
            goto error ;
         }
         isNew = FALSE ;
         goto done ;
      }
      else if ( SDB_FNE != rc )
      {
         PD_LOG( PDERROR, "Failed to get meta of lob, rc:%d", rc ) ;
         goto error ;
      }
      else
      {
         rc = SDB_OK ;
         isNew = TRUE ;
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__ENSURELOB, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 6
0
 // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__QUERYANDINVALIDATEMETADATA, "_rtnLocalLobStream::_queryAndInvalidateMetaData" )
 INT32 _rtnLocalLobStream::_queryAndInvalidateMetaData( _pmdEDUCB *cb,
                                                        _dmsLobMeta &meta )
 {
    INT32 rc = SDB_OK ;
    PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__QUERYANDINVALIDATEMETADATA ) ;
    rc = rtnQueryAndInvalidateLob( getFullName(), getOID(),
                                   cb, 1, _getDPSCB(), meta,
                                   NULL, NULL, TRUE ) ;
    if ( SDB_OK != rc )
    {
       PD_LOG( PDERROR, "failed to invalidate lob:%d", rc ) ;
       goto error ;
    }
 done:
    PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__QUERYANDINVALIDATEMETADATA, rc ) ;
    return rc ;
 error:
    goto done ;
 }
Ejemplo n.º 7
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__WRITE, "_rtnLocalLobStream::_write" )
   INT32 _rtnLocalLobStream::_write( const _rtnLobTuple &tuple,
                                     _pmdEDUCB *cb, BOOLEAN orUpdate )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__WRITE ) ;
      _dmsLobRecord record ;

      record.set( &getOID(),
                  tuple.tuple.columns.sequence,
                  tuple.tuple.columns.offset,
                  tuple.tuple.columns.len,
                  tuple.data ) ;

      if ( orUpdate )
      {
         rc = _su->lob()->writeOrUpdate( record, _mbContext, cb,
                                         _getDPSCB() ) ;
      }
      else
      {
         rc = _su->lob()->write( record, _mbContext, cb,
                                 _getDPSCB() ) ;
      }

      if ( SDB_OK != rc )
      {
         PD_LOG( PDERROR, "failed to write lob[%s],"
                 "sequence:%d, rc:%d", record._oid->str().c_str(),
                 record._sequence, rc ) ;
         goto error ;
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__WRITE, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 8
0
        std::shared_ptr<rapidjson::Document> Page::getJSONObject(long long headerpos)
        {
            //reading the Page
            tasking::RWLockGuard<> lock(m_rwLock, tasking::READ);
            //get the header first
            auto l_header = reinterpret_cast<HeaderMetaData*>(static_cast<char*>(m_header) + headerpos);
            //get the type
            auto l_objectType = l_header->getObjektType();

            //get the idx
            auto& l_metaIdx = meta::MetaIndex::getInstance();
            //get the meta dataset
            auto& l_meta = l_metaIdx[l_objectType];

            //create the document
            auto l_obj = std::make_shared<rapidjson::Document>();
            l_obj->SetObject();

            //now generate the inner part of the object
            rapidjson::Value l_value;
            l_value.SetObject();
            //calc the start id
            void* start = (static_cast<char*>(m_body) + l_header->getPos());
            auto temp = buildObject(l_objectType, start, l_value, l_obj->GetAllocator());
            if(temp == nullptr)
            {
                LOG_WARN << "build failed id: " << l_header->getOID();
                return nullptr;
            }
            //generate name
            auto l_objName = l_meta->getName();
            rapidjson::Value l_name(l_objName.c_str(), l_objName.length(), l_obj->GetAllocator());
            //now add the inner object
            l_obj->AddMember(l_name, l_value, l_obj->GetAllocator());

            return l_obj;
        }
Ejemplo n.º 9
0
 void _rtnLocalLobStream::_closeInner( _pmdEDUCB *cb )
 {
    if ( _hasLobPrivilege )
    {
       sdbGetRTNCB()->getLobAccessManager()->releaseAccessPrivilege(
          getFullName(), getOID(), _getMode(), uniqueId() ) ;
       _hasLobPrivilege = FALSE ;
    }
    if ( _mbContext && _su )
    {
       _su->data()->releaseMBContext( _mbContext ) ;
       _mbContext = NULL ;
    }
    if ( _su && _dmsCB )
    {
       sdbGetDMSCB()->suUnlock ( _su->CSID() ) ;
       _su = NULL ;
    }
    if ( _writeDMS )
    {
       _dmsCB->writeDown( cb ) ;
       _writeDMS = FALSE ;
    }
 }
Ejemplo n.º 10
0
Archivo: oid.cpp Proyecto: DINKIN/mongo
OID OIDInfo::getOID(JSContext* cx, JS::HandleValue value) {
    JS::RootedObject obj(cx, value.toObjectOrNull());
    return getOID(cx, obj);
}
Ejemplo n.º 11
0
CTransfer::CTransfer(unsigned int oid, SERootObject* root)
                : Transfer(oid, root)
{
        fprintf(stdout,"New Transfer oid %d\n", getOID());
}
Ejemplo n.º 12
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__UPDATE, "_rtnLocalLobStream::_update" )
   INT32 _rtnLocalLobStream::_update( const _rtnLobTuple &tuple,
                                      _pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;
      BOOLEAN accessInfoLocked = FALSE ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__UPDATE ) ;

      dmsLobRecord record ;
      const MsgLobTuple &t = tuple.tuple ;
      CHAR* buf = NULL ;

      record.set( &getOID(), t.columns.sequence, t.columns.offset,
                  t.columns.len, ( const CHAR * )tuple.data ) ;

      if ( DMS_LOB_META_SEQUENCE == t.columns.sequence &&
           SDB_LOB_MODE_WRITE == _getMode() &&
           0 == t.columns.offset &&
           t.columns.len >= sizeof(_dmsLobMeta) )
      {
         _rtnLobMetaCache* metaCache = NULL ;
         const _dmsLobMeta* meta = (const _dmsLobMeta*)tuple.data ;
         if ( meta->hasPiecesInfo() && t.columns.len < DMS_LOB_META_LENGTH )
         {
            rc = SDB_SYS ;
            PD_LOG( PDERROR, "Invalid lob meta data length:%d, rc=%d",
                    t.columns.len, rc ) ;
            goto error ;
         }

         SDB_ASSERT( NULL != _accessInfo, "_accessInfo is null" ) ;

         _accessInfo->lock() ;
         accessInfoLocked = TRUE ;

         metaCache = _accessInfo->getMetaCache() ;
         SDB_ASSERT( NULL != metaCache, "metaCache is null" ) ;
         SDB_ASSERT( NULL != metaCache->lobMeta(), "lob meta cache is null" ) ;

         if ( metaCache->needMerge() )
         {
            _rtnLobMetaCache newCache ;
            rc = newCache.cache( *(metaCache->lobMeta()) ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to cache lob meta, rc=%d", rc ) ;
               goto error ;
            }

            rc = newCache.merge( *meta, _su->getLobPageSize() ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to merge lob meta data, rc=%d", rc ) ;
               goto error ;
            }

            SDB_ASSERT( NULL != newCache.lobMeta(), "new lob meta cache is null" ) ;

            rc = metaCache->cache( *( newCache.lobMeta() ) ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to cache lob meta, rc=%d", rc ) ;
               goto error ;
            }

            buf = (CHAR*)SDB_OSS_MALLOC( record._dataLen > DMS_LOB_META_LENGTH ?
                                         record._dataLen : DMS_LOB_META_LENGTH ) ;
            if ( NULL == buf )
            {
               rc = SDB_OOM ;
               PD_LOG( PDERROR, "Failed to malloc buf, rc=%d", rc ) ;
               goto error ;
            }
            ossMemset( buf, 0, DMS_LOB_META_LENGTH ) ;

            ossMemcpy( buf, record._data, record._dataLen ) ;
            record._data = (const CHAR*)buf ;

            if ( newCache.lobMeta()->hasPiecesInfo() )
            {
               ossMemcpy( (void*)record._data, newCache.lobMeta(), DMS_LOB_META_LENGTH ) ;
               if ( record._dataLen < DMS_LOB_META_LENGTH )
               {
                  record._dataLen = DMS_LOB_META_LENGTH ;
               }
            }
            else
            {
               ossMemcpy( (void*)record._data, newCache.lobMeta(), sizeof( _dmsLobMeta ) ) ;
            }
         }
         else
         {
            rc = metaCache->cache( *meta ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to cache lob meta, rc=%d", rc ) ;
               goto error ;
            }
         }

         rc = _su->lob()->update( record, _mbContext, cb, _getDPSCB() ) ;
         if ( SDB_OK != rc )
         {
            PD_LOG( PDERROR, "failed to update to lob:%d", rc ) ;
            goto error ;
         }

         _accessInfo->unlock() ;
         accessInfoLocked = FALSE ;
      }
      else
      {
         rc = _su->lob()->update( record, _mbContext, cb, _getDPSCB() ) ;
         if ( SDB_OK != rc )
         {
            PD_LOG( PDERROR, "failed to update to lob:%d", rc ) ;
            goto error ;
         }
      }

   done:
      if ( accessInfoLocked )
      {
         _accessInfo->unlock() ;
      }
      SAFE_OSS_FREE( buf ) ;
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__UPDATE, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 13
0
   INT32 _rtnLocalLobStream::_queryLobMeta4Write( _pmdEDUCB *cb,
                                   _dmsLobMeta &meta,
                                   _rtnLobPiecesInfo* piecesInfo )
   {
      INT32 rc = SDB_OK ;
      _rtnLobMetaCache* metaCache = NULL ;
      const _dmsLobMeta* cachedMeta = NULL ;
      BOOLEAN accessInfoLocked = FALSE ;
      SDB_ASSERT( NULL != _accessInfo, "_accessInfo is null" ) ;
      SDB_ASSERT( SDB_LOB_MODE_WRITE == _getMode(), "should be write mode" ) ;

      _accessInfo->lock() ;
      accessInfoLocked = TRUE ;

      metaCache = _accessInfo->getMetaCache() ;
      if ( NULL == metaCache )
      {
         metaCache = SDB_OSS_NEW _rtnLobMetaCache() ;
         if ( NULL == metaCache )
         {
            rc = SDB_OOM ;
            PD_LOG( PDERROR, "Failed to new _rtnLobMetaCache, rc:%d", rc ) ;
            goto error ;
         }
         _accessInfo->setMetaCache( metaCache ) ;
      }
      else
      {
         metaCache->setNeedMerge( TRUE ) ;
      }

      cachedMeta = metaCache->lobMeta() ;
      if ( NULL == cachedMeta )
      {
         UINT32 readLen = 0 ;
         UINT32 len = DMS_LOB_META_LENGTH ;
         CHAR* buf = NULL ;
         dmsLobRecord record ;

         _getPool().clear() ;

         rc = _getPool().allocate( len, &buf ) ;
         if ( rc )
         {
            PD_LOG( PDERROR, "Failed to alloc buffer[%u], rc: %d",
                    len, rc ) ;
            goto error ;
         }

         record.set( &getOID(), DMS_LOB_META_SEQUENCE, 0, len, NULL ) ;

         rc = _su->lob()->read( record, _mbContext, cb, buf, readLen ) ;
         if ( SDB_OK == rc )
         {
            if ( readLen < sizeof( meta ) )
            {
               PD_LOG( PDERROR, "Read lob[%s]'s meta page len is less than "
                       "meta size[%u]", getOID().str().c_str(),
                       sizeof( meta ) ) ;
               rc = SDB_SYS ;
               goto error ;
            }

            ossMemcpy( &meta, buf, sizeof( meta ) ) ;

            if ( !meta.isDone() )
            {
               PD_LOG( PDINFO, "Lob[%s] meta[%s] is not available",
                       getOID().str().c_str(), meta.toString().c_str() ) ;
               rc = SDB_LOB_IS_NOT_AVAILABLE ;
               goto error ;
            }

            if ( meta.hasPiecesInfo() && NULL != piecesInfo )
            {
               INT32 length = meta._piecesInfoNum * (INT32)sizeof( _rtnLobPieces ) ;
               const CHAR* pieces = (const CHAR*)
                  ( buf + DMS_LOB_META_LENGTH - length ) ;

               rc = piecesInfo->readFrom( pieces, length ) ;
               if ( SDB_OK != rc )
               {
                  PD_LOG( PDINFO, "Failed to read pieces info of Lob[%s]",
                          getOID().str().c_str() ) ;
                  goto error ;
               }
            }

            rc = metaCache->cache( *(_dmsLobMeta*)buf ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDINFO, "Failed to cache meta data of Lob[%s]",
                       getOID().str().c_str() ) ;
               goto error ;
            }
         }
         else
         {
            if ( SDB_LOB_SEQUENCE_NOT_EXIST == rc )
            {
               rc = SDB_FNE ;
            }
            else if ( SDB_FNE != rc )
            {
               PD_LOG( PDERROR, "Failed to get meta of lob, rc:%d", rc ) ;
            }
            goto error ;
         }
      }
      else
      {
         ossMemcpy( &meta, cachedMeta, sizeof( meta ) ) ;

         if ( meta.hasPiecesInfo() && NULL != piecesInfo )
         {
            INT32 length = meta._piecesInfoNum *
                           (INT32)sizeof( _rtnLobPieces ) ;
            rc = piecesInfo->readFrom( (CHAR*)cachedMeta + DMS_LOB_META_LENGTH - length,
                                      length ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to read lob pieces info, rc:%d", rc ) ;
               goto error ;
            }
         }
      }

   done:
      if ( accessInfoLocked )
      {
         _accessInfo->unlock() ;
         accessInfoLocked = FALSE ;
      }
      return rc ;
   error:
      goto done ;
   }
Ejemplo n.º 14
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__QUERYLOBMETA, "_rtnLocalLobStream::_queryLobMeta" )
   INT32 _rtnLocalLobStream::_queryLobMeta( _pmdEDUCB *cb,
                                            _dmsLobMeta &meta,
                                            BOOLEAN allowUncompleted,
                                            _rtnLobPiecesInfo* piecesInfo )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__QUERYLOBMETA ) ;
      UINT32 len = _su->getLobPageSize() ;
      UINT32 readLen = 0 ;
      CHAR *buf = NULL ;
      dmsLobRecord record ;

      if ( SDB_LOB_MODE_WRITE == _getMode() )
      {
         rc = _queryLobMeta4Write( cb, meta, piecesInfo ) ;
         if ( SDB_OK != rc )
         {
            PD_LOG( PDERROR, "Failed to query meta for write, rc: %d", rc ) ;
            goto error ;
         }
         goto done ;
      }

      _getPool().clear() ;

      rc = _getPool().allocate( len, &buf ) ;
      if ( rc )
      {
         PD_LOG( PDERROR, "Failed to alloc buffer[%u], rc: %d",
                 len, rc ) ;
         goto error ;
      }

      record.set( &getOID(), DMS_LOB_META_SEQUENCE, 0, len, NULL ) ;

      rc = _su->lob()->read( record, _mbContext, cb, buf, readLen ) ;
      if ( SDB_OK == rc )
      {
         if ( readLen < sizeof( _dmsLobMeta ) )
         {
            PD_LOG( PDERROR, "Read lob[%s]'s meta page len is less than "
                    "meta size[%u]", getOID().str().c_str(),
                    sizeof( _dmsLobMeta ) ) ;
            rc = SDB_SYS ;
            goto error ;
         }
         ossMemcpy( (void*)&meta, buf, sizeof( meta ) ) ;
         if ( !meta.isDone() && !allowUncompleted )
         {
            PD_LOG( PDINFO, "Lob[%s] meta[%s] is not available",
                    getOID().str().c_str(), meta.toString().c_str() ) ;
            rc = SDB_LOB_IS_NOT_AVAILABLE ;
            goto error ;
         }

         if ( 0 == meta._modificationTime )
         {
            meta._modificationTime = meta._createTime ;
         }

         if ( meta._version >= DMS_LOB_META_MERGE_DATA_VERSION &&
              meta._lobLen > 0 &&
              readLen > DMS_LOB_META_LENGTH )
         {
            rc = _getPool().push( buf + DMS_LOB_META_LENGTH,
                                  ( meta._lobLen <= readLen-DMS_LOB_META_LENGTH ?
                                  meta._lobLen : readLen-DMS_LOB_META_LENGTH ),
                                  0 ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to push data to pool, rc:%d", rc ) ;
               goto error ;
            }
            _getPool().pushDone() ;
         }

         if ( NULL != piecesInfo &&
              meta.hasPiecesInfo() )
         {
            INT32 length = meta._piecesInfoNum * (INT32)sizeof( _rtnLobPieces ) ;
            const CHAR* piecesInfoBuf = (const CHAR*)
                                        ( buf + DMS_LOB_META_LENGTH - length ) ;

            rc = piecesInfo->readFrom( piecesInfoBuf, length ) ;
            if ( SDB_OK != rc )
            {
               PD_LOG( PDERROR, "Failed to read pieces info from meta, rc:%d", rc ) ;
               goto error ;
            }
         }

         goto done ;
      }
      else
      {
         if ( SDB_LOB_SEQUENCE_NOT_EXIST == rc )
         {
            rc = SDB_FNE ;
         }
         else if ( SDB_FNE != rc )
         {
            PD_LOG( PDERROR, "Failed to get meta of lob, rc:%d", rc ) ;
         }
         goto error ;
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__QUERYLOBMETA, rc ) ;
      return rc ;
   error:
      goto done ;
   }