Exemple #1
0
    that the tablet is unhealthy, the drain is removed and it is verified that
    the tablet returns to a healthy state.
    """
    logging.info('Performing %s drain cycles', self.num_drains)
    for attempt in xrange(self.num_drains):
      logging.info('Drain iteration %d of %d', attempt + 1, self.num_drains)
      for keyspace, num_shards in zip(self.env.keyspaces, self.env.num_shards):
        tablet_to_drain = self.get_tablet_to_drain(keyspace, num_shards)
        num_rows0 = self.get_row_count(tablet_to_drain)
        self.env.drain_tablet(tablet_to_drain)
        self.wait_for_drained_tablet(tablet_to_drain)
        self.insert_rows(keyspace, self.num_inserts,
                         starting_index=self.num_inserts * attempt)
        num_rows1 = self.get_row_count(tablet_to_drain)
        self.assertEquals(num_rows0, num_rows1)
        query_count0 = self.env.get_tablet_query_total_count(tablet_to_drain)
        self.read_rows(
            keyspace, self.num_inserts, self.num_inserts * (attempt + 1),
            self.env.get_tablet_cell(tablet_to_drain))
        self.env.undrain_tablet(tablet_to_drain)
        self.wait_for_undrained_tablet(tablet_to_drain)
        query_count1 = self.env.get_tablet_query_total_count(tablet_to_drain)
        logging.info('%s total query count before/after reads: %d/%d',
                     tablet_to_drain, query_count0, query_count1)
        self.assertEquals(query_count0, query_count1)


if __name__ == '__main__':
  base_cluster_test.main()

Exemple #2
0
            logging.info('Drain iteration %d of %d', attempt + 1,
                         self.num_drains)
            for keyspace, num_shards in zip(self.env.keyspaces,
                                            self.env.num_shards):
                tablet_to_drain = self.get_tablet_to_drain(
                    keyspace, num_shards)
                num_rows0 = self.get_row_count(tablet_to_drain)
                self.env.drain_tablet(tablet_to_drain)
                self.wait_for_drained_tablet(tablet_to_drain)
                self.insert_rows(keyspace,
                                 self.num_inserts,
                                 starting_index=self.num_inserts * attempt)
                num_rows1 = self.get_row_count(tablet_to_drain)
                self.assertEquals(num_rows0, num_rows1)
                query_count0 = self.env.get_tablet_query_total_count(
                    tablet_to_drain)
                self.read_rows(keyspace, self.num_inserts,
                               self.num_inserts * (attempt + 1),
                               self.env.get_tablet_cell(tablet_to_drain))
                self.env.undrain_tablet(tablet_to_drain)
                self.wait_for_undrained_tablet(tablet_to_drain)
                query_count1 = self.env.get_tablet_query_total_count(
                    tablet_to_drain)
                logging.info('%s total query count before/after reads: %d/%d',
                             tablet_to_drain, query_count0, query_count1)
                self.assertEquals(query_count0, query_count1)


if __name__ == '__main__':
    base_cluster_test.main()