Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-50132

collection not appearing in system:keyspaces until another bucket is created

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.1.0
    • 7.1.0
    • ns_server
    • None
    • Untriaged
    • 1
    • No

    Description

      the beforeAll() for this test is failing as below.  Regardless of how long the wait (100 seconds, even).   The only thing that makes the collection visible is by adding or deleting a different bucket. 

      couchbase-server-enterprise_7.1.0-1885-macos_x86_64.dmg and also others.

      java.lang.IllegalStateException: Query indexer is still not aware of bucket collection_1fe55803-d    Note: it's actually a collection.

      It's the second waitForQueryIndexerToHaveBucket that does not find the collection (until another bucket is created and deleted).
      The code that shows the issue is below, but the behavior (the collection not appearing in system:keyspaces) is also seen in the web console.

          cluster = Cluster.connect(seedNodes(), ClusterOptions.clusterOptions(authenticator()).environment(environment));
          Bucket bucket = cluster.bucket(config().bucketname());
          bucket.waitUntilReady(Duration.ofSeconds(50));
          waitForService(bucket, ServiceType.QUERY);
          waitForQueryIndexerToHaveBucket(cluster, config().bucketname());
          collectionManager = bucket.collections();    // Create the scope.collection (borrowed from CollectionManagerIntegrationTest )
          CollectionSpec collSpec = CollectionSpec.create(COLLECTION_NAME, SCOPE_NAME);
          collectionManager.createScope(SCOPE_NAME);
          waitUntilCondition(() -> scopeExists(collectionManager, SCOPE_NAME));
          collectionManager.createCollection(collSpec);
          waitUntilCondition(() -> collectionExists(collectionManager, collSpec));
          waitForQueryIndexerToHaveBucket(cluster, COLLECTION_NAME); 

       

       

        protected static void waitForQueryIndexerToHaveBucket(final Cluster cluster, final String bucketName) {    boolean ready = false;
          int guard = 100;
          while (!ready && guard != 0) {
            guard -= 1;
            String statement =
                    "SELECT COUNT(*) > 0 as present FROM system:keyspaces where name = '" + bucketName + "';"; // actually a collection
            QueryResult queryResult = cluster.query(statement);
            List<JsonObject> rows = queryResult.rowsAsObject();
            if (rows.size() == 1 && rows.get(0).getBoolean("present")) {
              ready = true;
            }      if (!ready) {
              //createAndDeleteBucket(); if I uncomment this call - that creates and deletes another bucket, the original collection appears in keyspaces
              try {
                Thread.sleep(1000);
              } catch (InterruptedException e) {
              }
            }
          }    if (guard == 0) {
            throw new IllegalStateException("Query indexer is still not aware of bucket " + bucketName);
          } 

       

          at com.couchbase.client.java.util.JavaIntegrationTest.waitForQueryIndexerToHaveBucket(JavaIntegrationTest.java:141)
          at com.couchbase.client.java.QueryCollectionIntegrationTest.beforeAll(QueryCollectionIntegrationTest.java:102)
       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hareen.kancharla Hareen Kancharla
            michael.reiche Michael Reiche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty