Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-62707

Users unable to see calendar to which they have subscriber in My Calendar page

    XMLWordPrintable

Details

    Description

      Issue Summary

      After recent update to TeamCal 6.1.7 users aren't able to see Calendars and their events on My Calendar page.

      After some investigation I have found that problem is caused by QueryDSL which is used to filter out records that aren't exist in DB, but saved in user preferences (method filterSubCalendarIds from AbstractCalendarDataStore class). It seems that for some reason this query couldn't find records in db while they actually exist. I have created custom version of a plugin (see code in this pr)  which performs more logging and asked customer to install it. This is a piece of logs that were produced by this version:

      2021-03-19 16:53:43,058 INFO [http-nio-8090-exec-99] [calendar3.rest.Interceptors.TeamCalResourceLoggingInterceptor] intercept Invoking rest endpoint [AbstractSubResourceMethod(CalendarResource#getSubCalendars)] via http method [GET]
      2021-03-19 16:53:43,059 DEBUG [http-nio-8090-exec-99] [extra.calendar3.rest.AbstractResource] getSubcalendarsInternal Start getting information about SubCalendars. CalendarContext: myCalendars, spaceKey: , subCalendarIdIncludes: 
      2021-03-19 16:53:43,059 DEBUG [http-nio-8090-exec-99] [confluence.extra.calendar3.DefaultCalendarUserPreferenceStore] getCachedUserPreference User preferences successfully retrieved from cache. User: ff80808163e50beb0163e5366ab80000
      2021-03-19 16:53:43,060 DEBUG [http-nio-8090-exec-99] [confluence.extra.calendar3.DefaultCalendarManager] getSubCalendarsInView Found 1 subCalendars in userPreferences. User: ff80808163e50beb0163e5366ab80000, SubCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 16:53:43,060 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.DelegatingCalendarDataStore] filterSubCalendarIds filterSubCalendarIds from DelegatingCalendarDataStore is called
      2021-03-19 16:53:43,061 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.DelegatingCalendarDataStore] filterSubCalendarIds CalendarDataStore class com.atlassian.confluence.extra.calendar3.calendarstore.ChildJiraSubCalendarDataStoreCachingDecorator is used for filtering subCalendars: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 16:53:43,062 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator] filterSubCalendarIds filterSubCalendarIds from CalendarDataStoreCachingDecorator is called
      2021-03-19 16:53:43,062 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.AbstractCalendarDataStore] filterSubCalendarIds QueryDSL is ready for TC, start filtering subCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      
      2021-03-19 16:53:43,064 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.AbstractCalendarDataStore] lambda$filterSubCalendarIds$4 Start filtering batch of subCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      
      2021-03-19 16:53:43,066 DEBUG [http-nio-8090-exec-99] [mysema.query.sql.AbstractSQLQuery] list query : select "ao_950dc3_tc_subcals"."ID"from "ao_950dc3_tc_subcals" "ao_950dc3_tc_subcals"where "ao_950dc3_tc_subcals"."ID" = ?
      2021-03-19 16:53:43,068 DEBUG [http-nio-8090-exec-99] [extra.calendar3.calendarstore.AbstractCalendarDataStore] lambda$filterSubCalendarIds$4 SubCalendarIds  found for query: from "ao_950dc3_tc_subcals" "ao_950dc3_tc_subcals"where "ao_950dc3_tc_subcals"."ID" = ?
      
      2021-03-19 16:53:43,069 DEBUG [http-nio-8090-exec-99] [confluence.extra.calendar3.DefaultCalendarManager] filterSubCalendarIds Amount of subCalendars left after filtering: 0, subCalendarIds: 
      
      2021-03-19 16:53:43,071 DEBUG [http-nio-8090-exec-99] [extra.calendar3.rest.AbstractResource] getSubcalendarsInternal Found 0 subCalendars. SubCalendarIds: 
      2021-03-19 16:53:43,072 INFO [http-nio-8090-exec-99] [extra.calendar3.rest.AbstractResource] getSubCalendarsResponse getSubCalendars successfully with total sub calendar is 0
      

      I have also created another custom version of the plugin which never calls QueryDSL, but uses old approach with ActiveObjects. If they use such version all records found without any problems and they don't have this problem at all. Here is a piece of log with active object usage (same subCalendarId is used):

      2021-03-19 17:02:53,989 INFO [http-nio-8090-exec-119] [calendar3.rest.Interceptors.TeamCalResourceLoggingInterceptor] intercept Invoking rest endpoint [AbstractSubResourceMethod(CalendarResource#getSubCalendars)] via http method [GET]
      2021-03-19 17:02:53,991 DEBUG [http-nio-8090-exec-119] [extra.calendar3.rest.AbstractResource] getSubcalendarsInternal Start getting information about SubCalendars. CalendarContext: myCalendars, spaceKey: , subCalendarIdIncludes: 
      2021-03-19 17:02:53,991 DEBUG [http-nio-8090-exec-119] [confluence.extra.calendar3.DefaultCalendarUserPreferenceStore] getCachedUserPreference User preferences successfully retrieved from cache. User: ff80808163e50beb0163e5366ab80000
      2021-03-19 17:02:53,992 DEBUG [http-nio-8090-exec-119] [confluence.extra.calendar3.DefaultCalendarManager] getSubCalendarsInView Found 1 subCalendars in userPreferences. User: ff80808163e50beb0163e5366ab80000, SubCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 17:02:53,992 DEBUG [http-nio-8090-exec-119] [extra.calendar3.calendarstore.DelegatingCalendarDataStore] filterSubCalendarIds filterSubCalendarIds from DelegatingCalendarDataStore is called
      2021-03-19 17:02:53,993 DEBUG [http-nio-8090-exec-119] [extra.calendar3.calendarstore.DelegatingCalendarDataStore] filterSubCalendarIds CalendarDataStore class com.atlassian.confluence.extra.calendar3.calendarstore.ChildJiraSubCalendarDataStoreCachingDecorator is used for filtering subCalendars: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 17:02:53,993 DEBUG [http-nio-8090-exec-119] [extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator] filterSubCalendarIds filterSubCalendarIds from CalendarDataStoreCachingDecorator is called
      
      2021-03-19 17:02:53,993 DEBUG [http-nio-8090-exec-119] [extra.calendar3.calendarstore.AbstractCalendarDataStore] filterSubCalendarIdsByAO Start filtering subCalendarIds using ActiveObjects: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 17:02:53,995 DEBUG [http-nio-8090-exec-119] [extra.calendar3.calendarstore.AbstractCalendarDataStore] filterSubCalendarIdsByAO Found 1 subCalendars after filtering using ActiveObjects: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      
      2021-03-19 17:02:53,995 DEBUG [http-nio-8090-exec-119] [confluence.extra.calendar3.DefaultCalendarManager] filterSubCalendarIds Amount of subCalendars left after filtering: 1, subCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      2021-03-19 17:02:53,996 DEBUG [http-nio-8090-exec-119] [extra.calendar3.rest.AbstractResource] getSubcalendarsInternal Found 1 subCalendars. SubCalendarIds: 3aeaa1b5-f337-455d-ad91-b28397d7850c
      

      Customer uses PostgresSql 9.6.18, but even if I use the same version this problem is not reproduced for me.
       

      P.s I have noticed that in the query that was logged on customer machine table name was in lower case:

      select "ao_950dc3_tc_subcals"."ID"from "ao_950dc3_tc_subcals" "ao_950dc3_tc_subcals"where "ao_950dc3_tc_subcals"."ID" = ?
      

      When I run this code locally table name is in upper case. I have tried to run this query with lower case table name locally (not in code, but in db directly) and it failed because such table couldn't be found. I'm not sure that this is the reason of this problem because there are no errors logged, but probably we should check it as well. 

      Steps to Reproduce

      I have never been able to reproduce this issue locally, but this is the steps that customer was doing to reproduce it:

      1. Open My Calendar page
      2. Subscribe to an existing calendar at which user haven't subscribed yet
      3. Reload the page - there is no events from this calendar
      4. Try to subscribe to this calendar again - calendar is not present in list of available calendars
      5. Go to space with this calendar and open Calendars tab - calendar is displayed

      Expected Results

      All events from calendars to which this user has subscribed are displayed on the My Calendar page

      Actual Results

      Calendars and their events aren't displayed in My Calendar page. This page is completely empty for user.

      Attachments

        Issue Links

          Activity

            People

              mleizerovich Maxim Leizerovich
              03cb0c04aa4f Irina Tiapchenko
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: