Examples of ByteArrayComparator


Examples of org.apache.directory.shared.ldap.model.schema.comparators.ByteArrayComparator

        } );

        MatchingRule matchingRule = new MatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
       
        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator

                    return comparator
                        .compare( getNormalizedValueReference(), binaryValue.getNormalizedValueReference() );
                }
                else
                {
                    return new ByteArrayComparator( null ).compare( getNormalizedValueReference(), binaryValue
                        .getNormalizedValueReference() );
                }
            }
            catch ( NamingException e )
            {
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator

        } );

        MatchingRule matchingRule = new MatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
       
        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            // The serial UID
            private static final long serialVersionUID = 1L;
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator

        } );

        MatchingRule matchingRule = new MatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
       
        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            // The serial UID
            private static final long serialVersionUID = 1L;
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator

    {
        s = new TestServerEntryUtils.S( "1.1.1.1", false );
        s.setSyntaxChecker( new AcceptAllSyntaxChecker( "1.1.1.1" ) );
        mr = new TestServerEntryUtils.MR( "1.1.2.1" );
        mr.syntax = s;
        mr.comparator = new ByteArrayComparator();
        mr.normalizer = new Normalizer()
        {
            private static final long serialVersionUID = 1L;
           
            public Value<?> normalize( Value<?> value ) throws NamingException
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator

        s = TestServerEntryUtils.syntaxFactory( "1.1.1.1", false );
        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = TestServerEntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );
       
        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            private static final long serialVersionUID = 1L;
           
            public Value<?> normalize( Value<?> value ) throws NamingException
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Bytes.ByteArrayComparator

        }
      }
   
      public void checkRegionBoundaries() {
        try {
          ByteArrayComparator comparator = new ByteArrayComparator();
          List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
          final RegionBoundariesInformation currentRegionBoundariesInformation =
              new RegionBoundariesInformation();
          for (HRegionInfo regionInfo : regions) {
            currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
            // For each region, get the start and stop key from the META and compare them to the
            // same information from the Stores.
            Path path = new Path(getConf().get(HConstants.HBASE_DIR) + "/"
                + Bytes.toString(regionInfo.getTableName()) + "/"
                + regionInfo.getEncodedName() + "/");
            FileSystem fs = path.getFileSystem(getConf());
            FileStatus[] files = fs.listStatus(path);
            // For all the column families in this region...
            byte[] storeFirstKey = null;
            byte[] storeLastKey = null;
            for (FileStatus file : files) {
              String fileName = file.getPath().toString();
              fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
              if (!fileName.startsWith(".") && !fileName.endsWith("recovered.edits")) {
                FileStatus[] storeFiles = fs.listStatus(file.getPath());
                // For all the stores in this column family.
                for (FileStatus storeFile : storeFiles) {
                  HFile.Reader reader = HFile.createReader(fs, storeFile.getPath(), new CacheConfig(
                      getConf()));
                  if ((reader.getFirstKey() != null)
                      && ((storeFirstKey == null) || (comparator.compare(storeFirstKey,
                          reader.getFirstKey()) > 0))) {
                    storeFirstKey = reader.getFirstKey();
                  }
                  if ((reader.getLastKey() != null)
                      && ((storeLastKey == null) || (comparator.compare(storeLastKey,
                          reader.getLastKey())) < 0)) {
                    storeLastKey = reader.getLastKey();
                  }
                  reader.close();
                }
              }
            }
            currentRegionBoundariesInformation.metaFirstKey = regionInfo.getStartKey();
            currentRegionBoundariesInformation.metaLastKey = regionInfo.getEndKey();
            currentRegionBoundariesInformation.storesFirstKey = keyOnly(storeFirstKey);
            currentRegionBoundariesInformation.storesLastKey = keyOnly(storeLastKey);
            if (currentRegionBoundariesInformation.metaFirstKey.length == 0)
              currentRegionBoundariesInformation.metaFirstKey = null;
            if (currentRegionBoundariesInformation.metaLastKey.length == 0)
              currentRegionBoundariesInformation.metaLastKey = null;
   
            // For a region to be correct, we need the META start key to be smaller or equal to the
            // smallest start key from all the stores, and the start key from the next META entry to
            // be bigger than the last key from all the current stores. First region start key is null;
            // Last region end key is null; some regions can be empty and not have any store.
   
            boolean valid = true;
            // Checking start key.
            if ((currentRegionBoundariesInformation.storesFirstKey != null)
                && (currentRegionBoundariesInformation.metaFirstKey != null)) {
              valid = valid
                  && comparator.compare(currentRegionBoundariesInformation.storesFirstKey,
                    currentRegionBoundariesInformation.metaFirstKey) >= 0;
            }
            // Checking stop key.
            if ((currentRegionBoundariesInformation.storesLastKey != null)
                && (currentRegionBoundariesInformation.metaLastKey != null)) {
              valid = valid
                  && comparator.compare(currentRegionBoundariesInformation.storesLastKey,
                    currentRegionBoundariesInformation.metaLastKey) < 0;
            }
            if (!valid) {
              errors.reportError(ERROR_CODE.BOUNDARIES_ERROR, "Found issues with regions boundaries",
                tablesInfo.get(Bytes.toString(regionInfo.getTableName())));
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Bytes.ByteArrayComparator

    }
  }

  public void checkRegionBoundaries() {
    try {
      ByteArrayComparator comparator = new ByteArrayComparator();
      List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
      final RegionBoundariesInformation currentRegionBoundariesInformation =
          new RegionBoundariesInformation();
      for (HRegionInfo regionInfo : regions) {
        currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
        // For each region, get the start and stop key from the META and compare them to the
        // same information from the Stores.
        Path path = new Path(getConf().get(HConstants.HBASE_DIR) + "/"
            + Bytes.toString(regionInfo.getTable().getName()) + "/"
            + regionInfo.getEncodedName() + "/");
        FileSystem fs = path.getFileSystem(getConf());
        FileStatus[] files = fs.listStatus(path);
        // For all the column families in this region...
        byte[] storeFirstKey = null;
        byte[] storeLastKey = null;
        for (FileStatus file : files) {
          String fileName = file.getPath().toString();
          fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
          if (!fileName.startsWith(".") && !fileName.endsWith("recovered.edits")) {
            FileStatus[] storeFiles = fs.listStatus(file.getPath());
            // For all the stores in this column family.
            for (FileStatus storeFile : storeFiles) {
              HFile.Reader reader = HFile.createReader(fs, storeFile.getPath(), new CacheConfig(
                  getConf()), getConf());
              if ((reader.getFirstKey() != null)
                  && ((storeFirstKey == null) || (comparator.compare(storeFirstKey,
                      reader.getFirstKey()) > 0))) {
                storeFirstKey = reader.getFirstKey();
              }
              if ((reader.getLastKey() != null)
                  && ((storeLastKey == null) || (comparator.compare(storeLastKey,
                      reader.getLastKey())) < 0)) {
                storeLastKey = reader.getLastKey();
              }
              reader.close();
            }
          }
        }
        currentRegionBoundariesInformation.metaFirstKey = regionInfo.getStartKey();
        currentRegionBoundariesInformation.metaLastKey = regionInfo.getEndKey();
        currentRegionBoundariesInformation.storesFirstKey = keyOnly(storeFirstKey);
        currentRegionBoundariesInformation.storesLastKey = keyOnly(storeLastKey);
        if (currentRegionBoundariesInformation.metaFirstKey.length == 0)
          currentRegionBoundariesInformation.metaFirstKey = null;
        if (currentRegionBoundariesInformation.metaLastKey.length == 0)
          currentRegionBoundariesInformation.metaLastKey = null;

        // For a region to be correct, we need the META start key to be smaller or equal to the
        // smallest start key from all the stores, and the start key from the next META entry to
        // be bigger than the last key from all the current stores. First region start key is null;
        // Last region end key is null; some regions can be empty and not have any store.

        boolean valid = true;
        // Checking start key.
        if ((currentRegionBoundariesInformation.storesFirstKey != null)
            && (currentRegionBoundariesInformation.metaFirstKey != null)) {
          valid = valid
              && comparator.compare(currentRegionBoundariesInformation.storesFirstKey,
                currentRegionBoundariesInformation.metaFirstKey) >= 0;
        }
        // Checking stop key.
        if ((currentRegionBoundariesInformation.storesLastKey != null)
            && (currentRegionBoundariesInformation.metaLastKey != null)) {
          valid = valid
              && comparator.compare(currentRegionBoundariesInformation.storesLastKey,
                currentRegionBoundariesInformation.metaLastKey) < 0;
        }
        if (!valid) {
          errors.reportError(ERROR_CODE.BOUNDARIES_ERROR, "Found issues with regions boundaries",
            tablesInfo.get(regionInfo.getTable()));
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Bytes.ByteArrayComparator

        }
      }
   
      public void checkRegionBoundaries() {
        try {
          ByteArrayComparator comparator = new ByteArrayComparator();
          List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
          final RegionBoundariesInformation currentRegionBoundariesInformation =
              new RegionBoundariesInformation();
          for (HRegionInfo regionInfo : regions) {
            currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
            // For each region, get the start and stop key from the META and compare them to the
            // same information from the Stores.
            Path path = new Path(getConf().get(HConstants.HBASE_DIR) + "/"
                + Bytes.toString(regionInfo.getTableName()) + "/"
                + regionInfo.getEncodedName() + "/");
            FileSystem fs = path.getFileSystem(getConf());
            FileStatus[] files = fs.listStatus(path);
            // For all the column families in this region...
            byte[] storeFirstKey = null;
            byte[] storeLastKey = null;
            for (FileStatus file : files) {
              String fileName = file.getPath().toString();
              fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
              if (!fileName.startsWith(".") && !fileName.endsWith("recovered.edits")) {
                FileStatus[] storeFiles = fs.listStatus(file.getPath());
                // For all the stores in this column family.
                for (FileStatus storeFile : storeFiles) {
                  HFile.Reader reader = HFile.createReader(fs, storeFile.getPath(), new CacheConfig(
                      getConf()));
                  if ((reader.getFirstKey() != null)
                      && ((storeFirstKey == null) || (comparator.compare(storeFirstKey,
                          reader.getFirstKey()) > 0))) {
                    storeFirstKey = reader.getFirstKey();
                  }
                  if ((reader.getLastKey() != null)
                      && ((storeLastKey == null) || (comparator.compare(storeLastKey,
                          reader.getLastKey())) < 0)) {
                    storeLastKey = reader.getLastKey();
                  }
                  reader.close();
                }
              }
            }
            currentRegionBoundariesInformation.metaFirstKey = regionInfo.getStartKey();
            currentRegionBoundariesInformation.metaLastKey = regionInfo.getEndKey();
            currentRegionBoundariesInformation.storesFirstKey = keyOnly(storeFirstKey);
            currentRegionBoundariesInformation.storesLastKey = keyOnly(storeLastKey);
            if (currentRegionBoundariesInformation.metaFirstKey.length == 0)
              currentRegionBoundariesInformation.metaFirstKey = null;
            if (currentRegionBoundariesInformation.metaLastKey.length == 0)
              currentRegionBoundariesInformation.metaLastKey = null;
   
            // For a region to be correct, we need the META start key to be smaller or equal to the
            // smallest start key from all the stores, and the start key from the next META entry to
            // be bigger than the last key from all the current stores. First region start key is null;
            // Last region end key is null; some regions can be empty and not have any store.
   
            boolean valid = true;
            // Checking start key.
            if ((currentRegionBoundariesInformation.storesFirstKey != null)
                && (currentRegionBoundariesInformation.metaFirstKey != null)) {
              valid = valid
                  && comparator.compare(currentRegionBoundariesInformation.storesFirstKey,
                    currentRegionBoundariesInformation.metaFirstKey) >= 0;
            }
            // Checking stop key.
            if ((currentRegionBoundariesInformation.storesLastKey != null)
                && (currentRegionBoundariesInformation.metaLastKey != null)) {
              valid = valid
                  && comparator.compare(currentRegionBoundariesInformation.storesLastKey,
                    currentRegionBoundariesInformation.metaLastKey) < 0;
            }
            if (!valid) {
              errors.reportError(ERROR_CODE.BOUNDARIES_ERROR, "Found issues with regions boundaries",
                tablesInfo.get(Bytes.toString(regionInfo.getTableName())));
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Bytes.ByteArrayComparator

    }
  }

  public void checkRegionBoundaries() {
    try {
      ByteArrayComparator comparator = new ByteArrayComparator();
      List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
      final RegionBoundariesInformation currentRegionBoundariesInformation =
          new RegionBoundariesInformation();
      Path hbaseRoot = FSUtils.getRootDir(getConf());
      for (HRegionInfo regionInfo : regions) {
        Path tableDir = FSUtils.getTableDir(hbaseRoot, regionInfo.getTable());
        currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
        // For each region, get the start and stop key from the META and compare them to the
        // same information from the Stores.
        Path path = new Path(tableDir, regionInfo.getEncodedName());
        FileSystem fs = path.getFileSystem(getConf());
        FileStatus[] files = fs.listStatus(path);
        // For all the column families in this region...
        byte[] storeFirstKey = null;
        byte[] storeLastKey = null;
        for (FileStatus file : files) {
          String fileName = file.getPath().toString();
          fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
          if (!fileName.startsWith(".") && !fileName.endsWith("recovered.edits")) {
            FileStatus[] storeFiles = fs.listStatus(file.getPath());
            // For all the stores in this column family.
            for (FileStatus storeFile : storeFiles) {
              HFile.Reader reader = HFile.createReader(fs, storeFile.getPath(), new CacheConfig(
                  getConf()));
              if ((reader.getFirstKey() != null)
                  && ((storeFirstKey == null) || (comparator.compare(storeFirstKey,
                      reader.getFirstKey()) > 0))) {
                storeFirstKey = reader.getFirstKey();
              }
              if ((reader.getLastKey() != null)
                  && ((storeLastKey == null) || (comparator.compare(storeLastKey,
                      reader.getLastKey())) < 0)) {
                storeLastKey = reader.getLastKey();
              }
              reader.close();
            }
          }
        }
        currentRegionBoundariesInformation.metaFirstKey = regionInfo.getStartKey();
        currentRegionBoundariesInformation.metaLastKey = regionInfo.getEndKey();
        currentRegionBoundariesInformation.storesFirstKey = keyOnly(storeFirstKey);
        currentRegionBoundariesInformation.storesLastKey = keyOnly(storeLastKey);
        if (currentRegionBoundariesInformation.metaFirstKey.length == 0)
          currentRegionBoundariesInformation.metaFirstKey = null;
        if (currentRegionBoundariesInformation.metaLastKey.length == 0)
          currentRegionBoundariesInformation.metaLastKey = null;

        // For a region to be correct, we need the META start key to be smaller or equal to the
        // smallest start key from all the stores, and the start key from the next META entry to
        // be bigger than the last key from all the current stores. First region start key is null;
        // Last region end key is null; some regions can be empty and not have any store.

        boolean valid = true;
        // Checking start key.
        if ((currentRegionBoundariesInformation.storesFirstKey != null)
            && (currentRegionBoundariesInformation.metaFirstKey != null)) {
          valid = valid
              && comparator.compare(currentRegionBoundariesInformation.storesFirstKey,
                currentRegionBoundariesInformation.metaFirstKey) >= 0;
        }
        // Checking stop key.
        if ((currentRegionBoundariesInformation.storesLastKey != null)
            && (currentRegionBoundariesInformation.metaLastKey != null)) {
          valid = valid
              && comparator.compare(currentRegionBoundariesInformation.storesLastKey,
                currentRegionBoundariesInformation.metaLastKey) < 0;
        }
        if (!valid) {
          errors.reportError(ERROR_CODE.BOUNDARIES_ERROR, "Found issues with regions boundaries",
            tablesInfo.get(regionInfo.getTable()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.