Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-21476

Support for nanosecond timestamps

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 2.1.1
    • None
    • None
    • nanoseconds, timestamps
    • Patch

    Description

      Introducing a new table attribute "NANOSECOND_TIMESTAMPS" to tell HBase to handle timestamps with nanosecond precision. This is useful for applications that timestamp updates at the source with nanoseconds and still want features like column family TTL and "hbase.hstore.time.to.purge.deletes" to work.

      The attribute should be specified either on new tables or on existing tables which have timestamps only with nanosecond precision. There's no migration from milliseconds to nanoseconds for already existing tables. We could add this migration as part of compaction if you think that would be useful, but that would obviously make the change more complex.

      I've added a new EnvironmentEdge method "currentTimeNano()" that uses java.time.Instant to get time in nanoseconds which means it will only work with Java 8. The idea is to gradually replace all places where "EnvironmentEdge.currentTime()" is used to have HBase working purely with nanoseconds (which is a prerequisite for HBASE-14070). Also, I've refactored ScanInfo and PartitionedMobCompactor to expect TableDescriptor as an argument which makes code a little cleaner and easier to extend.

      Couple more points:

      • column family TTL (specified in seconds) and "hbase.hstore.time.to.purge.deletes" (specified in milliseconds) options don't need to be changed, those are adjusted automatically.
      • Per cell TTL needs to be scaled by clients accordingly after "NANOSECOND_TIMESTAMPS" table attribute is specified.

      Looking for everyone's feedback to know if that's a worthwhile direction. Will add more comprehensive tests in a later patch.

      Attachments

        1. nanosecond_timestamps_v1.patch
          68 kB
          Andrey Elenskiy
        2. Apache HBase - Nanosecond Timestamps v1.pdf
          44 kB
          Andrey Elenskiy
        3. nanosecond_timestamps_v2.patch
          68 kB
          Andrey Elenskiy
        4. HBASE-21476.branch-2.1.0003.patch
          79 kB
          Andrey Elenskiy
        5. HBASE-21476.branch-2.1.0004.patch
          84 kB
          Andrey Elenskiy
        6. HBASE-21476.branch-2.4.001.patch
          84 kB
          Benoit Sigoure

        Activity

          People

            timoha Andrey Elenskiy
            timoha Andrey Elenskiy
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated: