v13 support
[smlar.git] / smlar_gist.c
index ce9c6d8..8cd044b 100644 (file)
@@ -3,7 +3,7 @@
 #include "fmgr.h"
 #include "access/gist.h"
 #include "access/skey.h"
-#include "access/tuptoaster.h"
+#include "access/heaptoast.h"
 #include "utils/memutils.h"
 
 typedef struct SmlSign {
@@ -34,17 +34,17 @@ typedef char *BITVECP;
 #define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
 #define HASH(sign, val) SETBIT((sign), HASHVAL(val))
 
-#define ARRKEY          0x01
-#define SIGNKEY         0x02
-#define ALLISTRUE       0x04
+#define ARRKEY                 0x01
+#define SIGNKEY                        0x02
+#define ALLISTRUE              0x04
 
-#define ISARRKEY(x) ( ((SmlSign*)x)->flag & ARRKEY )
-#define ISSIGNKEY(x)    ( ((SmlSign*)x)->flag & SIGNKEY )
-#define ISALLTRUE(x)    ( ((SmlSign*)x)->flag & ALLISTRUE )
+#define ISARRKEY(x)            ( ((SmlSign*)x)->flag & ARRKEY )
+#define ISSIGNKEY(x)   ( ((SmlSign*)x)->flag & SIGNKEY )
+#define ISALLTRUE(x)   ( ((SmlSign*)x)->flag & ALLISTRUE )
 
-#define CALCGTSIZE(flag, len) ( SMLSIGNHDRSZ + ( ( (flag) & ARRKEY ) ? ((len)*sizeof(uint32)) : (((flag) & ALLISTRUE) ? 0 : SIGLEN) ) )
-#define GETSIGN(x)      ( (BITVECP)( (char*)x+SMLSIGNHDRSZ ) )
-#define GETARR(x)       ( (uint32*)( (char*)x+SMLSIGNHDRSZ ) )
+#define CALCGTSIZE(flag, len)  ( SMLSIGNHDRSZ + ( ( (flag) & ARRKEY ) ? ((len)*sizeof(uint32)) : (((flag) & ALLISTRUE) ? 0 : SIGLEN) ) )
+#define GETSIGN(x)                             ( (BITVECP)( (char*)x+SMLSIGNHDRSZ ) )
+#define GETARR(x)                              ( (uint32*)( (char*)x+SMLSIGNHDRSZ ) )
 
 #define GETENTRY(vec,pos) ((SmlSign *) DatumGetPointer((vec)->vector[(pos)].key))
 
@@ -52,7 +52,7 @@ typedef char *BITVECP;
  * Fake IO
  */
 PG_FUNCTION_INFO_V1(gsmlsign_in);
-Datum       gsmlsign_in(PG_FUNCTION_ARGS);
+Datum  gsmlsign_in(PG_FUNCTION_ARGS);
 Datum
 gsmlsign_in(PG_FUNCTION_ARGS)
 {
@@ -61,7 +61,7 @@ gsmlsign_in(PG_FUNCTION_ARGS)
 }
 
 PG_FUNCTION_INFO_V1(gsmlsign_out);
-Datum       gsmlsign_out(PG_FUNCTION_ARGS);
+Datum  gsmlsign_out(PG_FUNCTION_ARGS);
 Datum
 gsmlsign_out(PG_FUNCTION_ARGS)
 {
@@ -75,7 +75,7 @@ gsmlsign_out(PG_FUNCTION_ARGS)
 
 /* Number of one-bits in an unsigned byte */
 static const uint8 number_of_ones[256] = {
-    0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
+       0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
@@ -96,24 +96,24 @@ static const uint8 number_of_ones[256] = {
 static int
 compareint(const void *va, const void *vb)
 {
-    uint32        a = *((uint32 *) va);
-       uint32        b = *((uint32 *) vb);
-                                
+       uint32  a = *((uint32 *) va);
+       uint32  b = *((uint32 *) vb);
+
        if (a == b)
                return 0;
        return (a > b) ? 1 : -1;
 }
 
 /*
- * Removes duplicates from an array of int4. 'l' is
+ * Removes duplicates from an array of int32. 'l' is
  * size of the input array. Returns the new size of the array.
  */
 static int
-uniqueint(uint32 *a, int4 l, int4 *max)
+uniqueint(uint32 *a, int32 l, int32 *max)
 {
-       uint32      *ptr,
-                          *res;
-       int4       cnt = 0;
+       uint32          *ptr,
+                               *res;
+       int32           cnt = 0;
 
        *max = 1;
 
@@ -149,7 +149,7 @@ Array2HashedArray(ProcTypeInfo info, ArrayType *a)
 {
        SimpleArray *s = Array2SimpleArray(info, a);
        SmlSign         *sign;
-       int           len, i;
+       int32           len, i;
        uint32          *ptr;
 
        len = CALCGTSIZE( ARRKEY, s->nelems );
@@ -164,8 +164,10 @@ Array2HashedArray(ProcTypeInfo info, ArrayType *a)
 
        ptr = GETARR(sign);
        for(i=0;i<s->nelems;i++)
-               ptr[i] = DatumGetUInt32( FunctionCall1( &s->info->hashFunc, s->elems[i] ) );
-                               
+               ptr[i] = DatumGetUInt32(FunctionCall1Coll(&s->info->hashFunc,
+                                                                                                 DEFAULT_COLLATION_OID,
+                                                                                                 s->elems[i]));
+
        /*
         * there is a collision of hash-function; len is always equal or less than
         * s->nelems
@@ -180,9 +182,9 @@ Array2HashedArray(ProcTypeInfo info, ArrayType *a)
 static int
 HashedElemCmp(const void *va, const void *vb)
 {
-    uint32        a = ((HashedElem *) va)->hash;
-       uint32        b = ((HashedElem *) vb)->hash;
-                                
+       uint32  a = ((HashedElem *) va)->hash;
+       uint32  b = ((HashedElem *) vb)->hash;
+
        if (a == b)
        {
                double  ma = ((HashedElem *) va)->idfMin;
@@ -198,10 +200,10 @@ HashedElemCmp(const void *va, const void *vb)
 }
 
 static int
-uniqueHashedElem(HashedElem *a, int4 l)
+uniqueHashedElem(HashedElem *a, int32 l)
 {
-       HashedElem      *ptr,
-                                         *res;
+       HashedElem      *ptr,
+                               *res;
 
        if (l <= 1)
                return l;
@@ -239,8 +241,12 @@ getHashedCache(void *cache)
                getFmgrInfoHash(stat->info);
                for(i=0;i<stat->nelems;i++)
                {
-                       uint32  hash = DatumGetUInt32( FunctionCall1( &stat->info->hashFunc, stat->elems[i].datum ) );
-                       int             index = HASHVAL(hash);  
+                       uint32  hash;
+
+                       hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc,
+                                                                                                       DEFAULT_COLLATION_OID,
+                                                                                                       stat->elems[i].datum));
+                       int             index = HASHVAL(hash);
 
                        stat->helems[i].hash = hash;
                        stat->helems[i].idfMin = stat->helems[i].idfMax = stat->elems[i].idf;   
@@ -252,7 +258,7 @@ getHashedCache(void *cache)
                                stat->selems[index].idfMax = stat->elems[i].idf;
                }
 
-               stat->nhelems = uniqueHashedElem( stat->helems, stat->nelems); 
+               stat->nhelems = uniqueHashedElem( stat->helems, stat->nelems);
        }
 
        return stat;
@@ -296,7 +302,9 @@ fillHashVal(void *cache, SimpleArray *a)
        getFmgrInfoHash(a->info);
 
        for(i=0;i<a->nelems;i++)
-               a->hash[i] = DatumGetUInt32( FunctionCall1( &a->info->hashFunc, a->elems[i] ) );
+               a->hash[i] = DatumGetUInt32(FunctionCall1Coll(&a->info->hashFunc,
+                                                                                                         DEFAULT_COLLATION_OID,
+                                                                                                         a->elems[i]));
 }
 
 
@@ -309,7 +317,7 @@ hasHashedElem(SmlSign  *a, uint32 h)
 
        while (StopLow < StopHigh) {
                StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
-               
+
                if ( *StopMiddle == h )
                        return true;
                else if ( *StopMiddle < h )
@@ -324,20 +332,20 @@ hasHashedElem(SmlSign  *a, uint32 h)
 static void
 makesign(BITVECP sign, SmlSign *a)
 {
-       int   i;
+       int32   i;
        uint32  *ptr = GETARR(a);
 
        MemSet((void *) sign, 0, sizeof(BITVEC));
-       SETBIT(sign, SIGLENBIT);    /* set last unused bit */
+       SETBIT(sign, SIGLENBIT);   /* set last unused bit */
 
        for (i = 0; i < a->size; i++)
                HASH(sign, ptr[i]);
 }
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-       int   size = 0,
+       int32   size = 0,
                        i;
 
        LOOPBYTE
@@ -362,7 +370,7 @@ gsmlsign_compress(PG_FUNCTION_ARGS)
                sign = Array2HashedArray(NULL, a);
 
                if ( VARSIZE(sign) > TOAST_INDEX_TARGET )
-               {       /* make signature due to its big size */ 
+               {       /* make signature due to its big size */
                        SmlSign *tmpsign;
                        int             len;
 
@@ -373,14 +381,14 @@ gsmlsign_compress(PG_FUNCTION_ARGS)
 
                        makesign(GETSIGN(tmpsign), sign);
                        tmpsign->size = sizebitvec(GETSIGN(tmpsign));
-                       tmpsign->maxrepeat = sign->maxrepeat; 
+                       tmpsign->maxrepeat = sign->maxrepeat;
                        sign = tmpsign;
                }
 
                retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(sign),
                                                entry->rel, entry->page,
-                                               entry->offset, FALSE);
+                                               entry->offset, false);
        }
        else if ( ISSIGNKEY(DatumGetPointer(entry->key)) &&
                                !ISALLTRUE(DatumGetPointer(entry->key)) )
@@ -391,8 +399,8 @@ gsmlsign_compress(PG_FUNCTION_ARGS)
 
                if ( sign->size == SIGLENBIT )
                {
-                       int   len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
-                       int   maxrepeat = sign->maxrepeat;
+                       int32   len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
+                       int32   maxrepeat = sign->maxrepeat;
 
                        sign = (SmlSign *) palloc(len);
                        SET_VARSIZE(sign, len);
@@ -404,10 +412,10 @@ gsmlsign_compress(PG_FUNCTION_ARGS)
 
                        gistentryinit(*retval, PointerGetDatum(sign),
                                                        entry->rel, entry->page,
-                                                       entry->offset, FALSE);
+                                                       entry->offset, false);
                }
        }
-               
+
        PG_RETURN_POINTER(retval);
 }
 
@@ -416,8 +424,8 @@ Datum gsmlsign_decompress(PG_FUNCTION_ARGS);
 Datum
 gsmlsign_decompress(PG_FUNCTION_ARGS)
 {
-       GISTENTRY       *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
-       SmlSign         *key =  (SmlSign*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
+       GISTENTRY       *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       SmlSign         *key =  (SmlSign*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
 
        if (key != (SmlSign *) DatumGetPointer(entry->key))
        {
@@ -425,7 +433,7 @@ gsmlsign_decompress(PG_FUNCTION_ARGS)
 
                gistentryinit(*retval, PointerGetDatum(key),
                                                entry->rel, entry->page,
-                                               entry->offset, FALSE);
+                                               entry->offset, false);
 
                PG_RETURN_POINTER(retval);
        }
@@ -439,11 +447,11 @@ gsmlsign_decompress(PG_FUNCTION_ARGS)
 static bool
 unionkey(BITVECP sbase, SmlSign *add)
 {
-       int   i;
+       int32   i;
 
        if (ISSIGNKEY(add))
        {
-               BITVECP     sadd = GETSIGN(add);
+               BITVECP sadd = GETSIGN(add);
 
                if (ISALLTRUE(add))
                        return true;
@@ -453,7 +461,7 @@ unionkey(BITVECP sbase, SmlSign *add)
        }
        else
        {
-               uint32       *ptr = GETARR(add);
+               uint32  *ptr = GETARR(add);
 
                for (i = 0; i < add->size; i++)
                        HASH(sbase, ptr[i]);
@@ -468,12 +476,12 @@ Datum
 gsmlsign_union(PG_FUNCTION_ARGS)
 {
        GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
-       int        *size = (int *) PG_GETARG_POINTER(1);
-       BITVEC      base;
-       int           i,
+       int                             *size = (int *) PG_GETARG_POINTER(1);
+       BITVEC                  base;
+       int32           i,
                                len,
                                maxrepeat = 1;
-       int4        flag = 0;
+       int32           flag = 0;
        SmlSign    *result;
 
        MemSet((void *) base, 0, sizeof(BITVEC));
@@ -496,13 +504,13 @@ gsmlsign_union(PG_FUNCTION_ARGS)
        result->flag = flag;
        result->maxrepeat = maxrepeat;
 
-       if (!ISALLTRUE(result)) 
+       if (!ISALLTRUE(result))
        {
                memcpy((void *) GETSIGN(result), (void *) base, sizeof(BITVEC));
                result->size = sizebitvec(GETSIGN(result));
        }
        else
-               result->size = SIGLENBIT; 
+               result->size = SIGLENBIT;
 
        PG_RETURN_POINTER(result);
 }
@@ -534,7 +542,7 @@ gsmlsign_same(PG_FUNCTION_ARGS)
                }
                else
                {
-                       int   i;
+                       int32   i;
                        BITVECP sa = GETSIGN(a),
                                        sb = GETSIGN(b);
 
@@ -557,7 +565,7 @@ gsmlsign_same(PG_FUNCTION_ARGS)
        {
                uint32  *ptra = GETARR(a),
                                *ptrb = GETARR(b);
-               int   i;
+               int32   i;
 
                *result = true;
                for (i = 0; i < a->size; i++)
@@ -579,9 +587,9 @@ gsmlsign_same(PG_FUNCTION_ARGS)
 static int
 hemdistsign(BITVECP a, BITVECP b)
 {
-    int         i,
-                               diff,
-                               dist = 0;
+       int     i,
+               diff,
+               dist = 0;
 
        LOOPBYTE
        {
@@ -590,7 +598,7 @@ hemdistsign(BITVECP a, BITVECP b)
        }
        return dist;
 }
-                                                                                                                                        
+
 static int
 hemdist(SmlSign *a, SmlSign *b)
 {
@@ -612,18 +620,18 @@ Datum gsmlsign_penalty(PG_FUNCTION_ARGS);
 Datum
 gsmlsign_penalty(PG_FUNCTION_ARGS)
 {
-    GISTENTRY  *origentry = (GISTENTRY *) PG_GETARG_POINTER(0); /* always ISSIGNKEY */
-       GISTENTRY  *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
-       float      *penalty = (float *) PG_GETARG_POINTER(2);
-       SmlSign *origval = (SmlSign *) DatumGetPointer(origentry->key);
-       SmlSign *newval = (SmlSign *) DatumGetPointer(newentry->key);
-       BITVECP     orig = GETSIGN(origval);
+       GISTENTRY       *origentry = (GISTENTRY *) PG_GETARG_POINTER(0); /* always ISSIGNKEY */
+       GISTENTRY       *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
+       float           *penalty = (float *) PG_GETARG_POINTER(2);
+       SmlSign         *origval = (SmlSign *) DatumGetPointer(origentry->key);
+       SmlSign         *newval = (SmlSign *) DatumGetPointer(newentry->key);
+       BITVECP         orig = GETSIGN(origval);
 
        *penalty = 0.0;
 
        if (ISARRKEY(newval))
        {
-               BITVEC      sign;
+               BITVEC  sign;
 
                makesign(sign, newval);
 
@@ -644,22 +652,22 @@ gsmlsign_penalty(PG_FUNCTION_ARGS)
 
 typedef struct
 {
-       bool        allistrue;
-       int32           size;
-       BITVEC      sign;
+       bool    allistrue;
+       int32   size;
+       BITVEC  sign;
 } CACHESIGN;
 
 static void
 fillcache(CACHESIGN *item, SmlSign *key)
 {
-    item->allistrue = false;
+       item->allistrue = false;
        item->size = key->size;
 
-       if (ISARRKEY(key)) 
+       if (ISARRKEY(key))
        {
                makesign(item->sign, key);
-               item->size = sizebitvec( item->sign ); 
-       } 
+               item->size = sizebitvec( item->sign );
+       }
        else if (ISALLTRUE(key))
                item->allistrue = true;
        else
@@ -671,7 +679,7 @@ fillcache(CACHESIGN *item, SmlSign *key)
 typedef struct
 {
        OffsetNumber pos;
-       int4        cost;
+       int32           cost;
 } SPLITCOST;
 
 static int
@@ -711,22 +719,22 @@ gsmlsign_picksplit(PG_FUNCTION_ARGS)
        GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
        OffsetNumber k,
                                j;
-       SmlSign         *datum_l,
+       SmlSign         *datum_l,
                                *datum_r;
-       BITVECP     union_l,
+       BITVECP         union_l,
                                union_r;
-       int4        size_alpha,
+       int32           size_alpha,
                                size_beta;
-       int4        size_waste,
+       int32           size_waste,
                                waste = -1;
-       int4        nbytes;
+       int32           nbytes;
        OffsetNumber seed_1 = 0,
                                seed_2 = 0;
        OffsetNumber *left,
                                *right;
        OffsetNumber maxoff;
-       BITVECP     ptr;
-       int         i;
+       BITVECP         ptr;
+       int                     i;
        CACHESIGN  *cache;
        SPLITCOST  *costvector;
 
@@ -738,7 +746,7 @@ gsmlsign_picksplit(PG_FUNCTION_ARGS)
        cache = (CACHESIGN *) palloc(sizeof(CACHESIGN) * (maxoff + 2));
        fillcache(&cache[FirstOffsetNumber], GETENTRY(entryvec, FirstOffsetNumber));
 
-       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
+       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
        {
                for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j))
                {
@@ -772,7 +780,7 @@ gsmlsign_picksplit(PG_FUNCTION_ARGS)
                datum_l = (SmlSign *) palloc(CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
                SET_VARSIZE(datum_l, CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
                datum_l->flag = SIGNKEY | ALLISTRUE;
-               datum_l->size = SIGLENBIT; 
+               datum_l->size = SIGLENBIT;
        }
        else
        {
@@ -932,14 +940,14 @@ Datum
 gsmlsign_consistent(PG_FUNCTION_ARGS)
 {
        GISTENTRY               *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
-       StrategyNumber  strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-       bool                    *recheck = (bool *) PG_GETARG_POINTER(4);
+       StrategyNumber  strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+       bool                    *recheck = (bool *) PG_GETARG_POINTER(4);
        ArrayType               *a;
        SmlSign                 *key = (SmlSign*)DatumGetPointer(entry->key);
        int                             res = false;
        SmlSign                 *query;
        SimpleArray             *s;
-       int                   i;
+       int32                   i;
 
        fcinfo->flinfo->fn_extra = SearchArrayCache(
                                                                        fcinfo->flinfo->fn_extra,
@@ -959,8 +967,8 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                }
                else if (ISARRKEY(key))
                {
-                       uint32          *kptr = GETARR(key),
-                                                       *qptr = GETARR(query);
+                       uint32  *kptr = GETARR(key),
+                                       *qptr = GETARR(query);
 
                        while( kptr - GETARR(key) < key->size && qptr - GETARR(query) < query->size )
                        {
@@ -1019,8 +1027,8 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
        }
        else if (ISARRKEY(key))
        {
-               uint32      *kptr = GETARR(key),
-                                       *qptr = GETARR(query);
+               uint32  *kptr = GETARR(key),
+                               *qptr = GETARR(query);
 
                Assert( GIST_LEAF(entry) );
 
@@ -1079,7 +1087,7 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
 
                                        if (  ((double)Min(key->size, s->nelems)) / power >= GetSmlarLimit() )
                                        {
-                                               int  cnt = 0;
+                                               int  cnt = 0;
 
                                                while( kptr - GETARR(key) < key->size && qptr - GETARR(query) < query->size )
                                                {
@@ -1094,7 +1102,7 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                                                                qptr++;
                                                        }
                                                }
-                       
+
                                                if ( ((double)cnt) / power >= GetSmlarLimit() )
                                                        res = true;
                                        }
@@ -1107,7 +1115,7 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
        else
        {       /* signature */
                BITVECP sign = GETSIGN(key);
-               int   count = 0;
+               int32   count = 0;
 
                fillHashVal(fcinfo->flinfo->fn_extra, s);
 
@@ -1122,7 +1130,7 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                                                                        sumQ = 0.0,
                                                                        sumK = 0.0;
                                                double          maxKTF = getIdfMaxLimit(key);
-       
+
                                                Assert( s->df );
                                                if ( stat->info != s->info )
                                                        elog(ERROR,"Statistic and actual argument have different type");
@@ -1157,13 +1165,13 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                                        break;
                                case ST_COSINE:
                                        {
-                                               double          power;
+                                               double  power;
 
                                                power = sqrt( ((double)(key->size)) * ((double)(s->nelems)) );
 
                                                for(i=0; i<s->nelems; i++)
                                                        count += GETBIT(sign, HASHVAL(s->hash[i]));
-               
+
                                                if ( ((double)count) / power >= GetSmlarLimit() )
                                                        res = true;
                                        }
@@ -1183,7 +1191,7 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                                                                        sumQ = 0.0,
                                                                        minK = -1.0;
                                                double          maxKTF = getIdfMaxLimit(key);
-       
+
                                                Assert( s->df );
                                                if ( stat->info != s->info )
                                                        elog(ERROR,"Statistic and actual argument have different type");
@@ -1209,8 +1217,8 @@ gsmlsign_consistent(PG_FUNCTION_ARGS)
                                        {
                                                for(i=0; i<s->nelems; i++)
                                                        count += GETBIT(sign, HASHVAL(s->hash[i]));
-                               
-                                               if ( s->nelems == count  || ((double)count) / ((double)(s->nelems)) >= GetSmlarLimit() )
+
+                                               if ( s->nelems == count  || sqrt(((double)count) / ((double)(s->nelems))) >= GetSmlarLimit() )
                                                        res = true;
                                        }
                                        break;