You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Weishung Chung <we...@gmail.com> on 2011/02/04 08:41:24 UTC

question about HTableDescriptor

I am looking at the following protected HTableDescriptor's constructor,
but i can't figure out the purpose of the
Map<ImmutableBytesWritable,ImmutableBytesWritable>
values ? What does it contain?


   protected HTableDescriptor(final byte [] name, HColumnDescriptor[]
families,

      Map<ImmutableBytesWritable,ImmutableBytesWritable> values)


Thank you,

Re: question about HTableDescriptor

Posted by Weishung Chung <we...@gmail.com>.
That's really good explanation! Thanks alot :D
Have a good day !

On Fri, Feb 4, 2011 at 2:27 AM, Lars George <la...@gmail.com> wrote:

> You can see this from the first few lines in the HTableDescriptor.java,
> i.e.
>
>  public static final String FAMILIES = "FAMILIES";
>  public static final ImmutableBytesWritable FAMILIES_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(FAMILIES));
>  public static final String MAX_FILESIZE = "MAX_FILESIZE";
>  public static final ImmutableBytesWritable MAX_FILESIZE_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(MAX_FILESIZE));
>  public static final String READONLY = "READONLY";
>  public static final ImmutableBytesWritable READONLY_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(READONLY));
>  public static final String MEMSTORE_FLUSHSIZE = "MEMSTORE_FLUSHSIZE";
>  public static final ImmutableBytesWritable MEMSTORE_FLUSHSIZE_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(MEMSTORE_FLUSHSIZE));
>  public static final String IS_ROOT = "IS_ROOT";
>  public static final ImmutableBytesWritable IS_ROOT_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(IS_ROOT));
>  public static final String IS_META = "IS_META";
>
>  public static final ImmutableBytesWritable IS_META_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(IS_META));
>
>  public static final String DEFERRED_LOG_FLUSH = "DEFERRED_LOG_FLUSH";
>  public static final ImmutableBytesWritable DEFERRED_LOG_FLUSH_KEY =
>    new ImmutableBytesWritable(Bytes.toBytes(DEFERRED_LOG_FLUSH));
>
> These are the "keys" in the map and the "value" are whatever the key
> is expecting, so could be true/false or a number. They are set using
> "setValue()" throughout the code like so:
>
>  /**
>   * @return memory cache flush size for each hregion
>   */
>  public long getMemStoreFlushSize() {
>    byte [] value = getValue(MEMSTORE_FLUSHSIZE_KEY);
>    if (value != null)
>      return Long.valueOf(Bytes.toString(value)).longValue();
>    return DEFAULT_MEMSTORE_FLUSH_SIZE;
>  }
>
>  /**
>   * @param memstoreFlushSize memory cache flush size for each hregion
>   */
>  public void setMemStoreFlushSize(long memstoreFlushSize) {
>    setValue(MEMSTORE_FLUSHSIZE_KEY,
>      Bytes.toBytes(Long.toString(memstoreFlushSize)));
>  }
>
> That constructor is mainly used to create a clone of the HTD with the
> current value map, i.e. every current property of the HTD other than
> the name and column family map.
>
> Lars
>
>
>
> On Fri, Feb 4, 2011 at 9:12 AM, Wei Shung Chung <we...@gmail.com>
> wrote:
> > Thank you but I would like to know what kinds of key value pairs that
> serve
> > as the table descriptors in the values map. I know the column map stores
> the
> > column name & column descriptor pair as the map entry. I should spend
> more
> > time on the codes again tomorrow.
> >
> > Sent from my iPhone
> >
> > On Feb 4, 2011, at 2:02 AM, Lars George <la...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> Did you read the comment above?
> >>
> >>  /**
> >>  * Private constructor used internally creating table descriptors for
> >>  * catalog tables: e.g. .META. and -ROOT-.
> >>  */
> >>
> >> Explains it, no?
> >>
> >> Lars
> >>
> >> On Fri, Feb 4, 2011 at 8:41 AM, Weishung Chung <we...@gmail.com>
> wrote:
> >>>
> >>> I am looking at the following protected HTableDescriptor's constructor,
> >>> but i can't figure out the purpose of the
> >>> Map<ImmutableBytesWritable,ImmutableBytesWritable>
> >>> values ? What does it contain?
> >>>
> >>>
> >>>  protected HTableDescriptor(final byte [] name, HColumnDescriptor[]
> >>> families,
> >>>
> >>>     Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
> >>>
> >>>
> >>> Thank you,
> >>>
> >
>

Re: question about HTableDescriptor

Posted by Lars George <la...@gmail.com>.
You can see this from the first few lines in the HTableDescriptor.java, i.e.

  public static final String FAMILIES = "FAMILIES";
  public static final ImmutableBytesWritable FAMILIES_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(FAMILIES));
  public static final String MAX_FILESIZE = "MAX_FILESIZE";
  public static final ImmutableBytesWritable MAX_FILESIZE_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(MAX_FILESIZE));
  public static final String READONLY = "READONLY";
  public static final ImmutableBytesWritable READONLY_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(READONLY));
  public static final String MEMSTORE_FLUSHSIZE = "MEMSTORE_FLUSHSIZE";
  public static final ImmutableBytesWritable MEMSTORE_FLUSHSIZE_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(MEMSTORE_FLUSHSIZE));
  public static final String IS_ROOT = "IS_ROOT";
  public static final ImmutableBytesWritable IS_ROOT_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(IS_ROOT));
  public static final String IS_META = "IS_META";

  public static final ImmutableBytesWritable IS_META_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(IS_META));

  public static final String DEFERRED_LOG_FLUSH = "DEFERRED_LOG_FLUSH";
  public static final ImmutableBytesWritable DEFERRED_LOG_FLUSH_KEY =
    new ImmutableBytesWritable(Bytes.toBytes(DEFERRED_LOG_FLUSH));

These are the "keys" in the map and the "value" are whatever the key
is expecting, so could be true/false or a number. They are set using
"setValue()" throughout the code like so:

  /**
   * @return memory cache flush size for each hregion
   */
  public long getMemStoreFlushSize() {
    byte [] value = getValue(MEMSTORE_FLUSHSIZE_KEY);
    if (value != null)
      return Long.valueOf(Bytes.toString(value)).longValue();
    return DEFAULT_MEMSTORE_FLUSH_SIZE;
  }

  /**
   * @param memstoreFlushSize memory cache flush size for each hregion
   */
  public void setMemStoreFlushSize(long memstoreFlushSize) {
    setValue(MEMSTORE_FLUSHSIZE_KEY,
      Bytes.toBytes(Long.toString(memstoreFlushSize)));
  }

That constructor is mainly used to create a clone of the HTD with the
current value map, i.e. every current property of the HTD other than
the name and column family map.

Lars



On Fri, Feb 4, 2011 at 9:12 AM, Wei Shung Chung <we...@gmail.com> wrote:
> Thank you but I would like to know what kinds of key value pairs that serve
> as the table descriptors in the values map. I know the column map stores the
> column name & column descriptor pair as the map entry. I should spend more
> time on the codes again tomorrow.
>
> Sent from my iPhone
>
> On Feb 4, 2011, at 2:02 AM, Lars George <la...@gmail.com> wrote:
>
>> Hi,
>>
>> Did you read the comment above?
>>
>>  /**
>>  * Private constructor used internally creating table descriptors for
>>  * catalog tables: e.g. .META. and -ROOT-.
>>  */
>>
>> Explains it, no?
>>
>> Lars
>>
>> On Fri, Feb 4, 2011 at 8:41 AM, Weishung Chung <we...@gmail.com> wrote:
>>>
>>> I am looking at the following protected HTableDescriptor's constructor,
>>> but i can't figure out the purpose of the
>>> Map<ImmutableBytesWritable,ImmutableBytesWritable>
>>> values ? What does it contain?
>>>
>>>
>>>  protected HTableDescriptor(final byte [] name, HColumnDescriptor[]
>>> families,
>>>
>>>     Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
>>>
>>>
>>> Thank you,
>>>
>

Re: question about HTableDescriptor

Posted by Wei Shung Chung <we...@gmail.com>.
Thank you but I would like to know what kinds of key value pairs that  
serve as the table descriptors in the values map. I know the column  
map stores the column name & column descriptor pair as the map entry.  
I should spend more time on the codes again tomorrow.

Sent from my iPhone

On Feb 4, 2011, at 2:02 AM, Lars George <la...@gmail.com> wrote:

> Hi,
>
> Did you read the comment above?
>
>  /**
>   * Private constructor used internally creating table descriptors for
>   * catalog tables: e.g. .META. and -ROOT-.
>   */
>
> Explains it, no?
>
> Lars
>
> On Fri, Feb 4, 2011 at 8:41 AM, Weishung Chung <we...@gmail.com>  
> wrote:
>> I am looking at the following protected HTableDescriptor's  
>> constructor,
>> but i can't figure out the purpose of the
>> Map<ImmutableBytesWritable,ImmutableBytesWritable>
>> values ? What does it contain?
>>
>>
>>   protected HTableDescriptor(final byte [] name, HColumnDescriptor[]
>> families,
>>
>>      Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
>>
>>
>> Thank you,
>>

Re: question about HTableDescriptor

Posted by Lars George <la...@gmail.com>.
Hi,

Did you read the comment above?

  /**
   * Private constructor used internally creating table descriptors for
   * catalog tables: e.g. .META. and -ROOT-.
   */

Explains it, no?

Lars

On Fri, Feb 4, 2011 at 8:41 AM, Weishung Chung <we...@gmail.com> wrote:
> I am looking at the following protected HTableDescriptor's constructor,
> but i can't figure out the purpose of the
> Map<ImmutableBytesWritable,ImmutableBytesWritable>
> values ? What does it contain?
>
>
>   protected HTableDescriptor(final byte [] name, HColumnDescriptor[]
> families,
>
>      Map<ImmutableBytesWritable,ImmutableBytesWritable> values)
>
>
> Thank you,
>