summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2021-10-29 15:34:38 -0500
committerEric Eastwood <erice@element.io>2021-10-29 15:34:38 -0500
commitc772b35a257afaeb989a0c9b2690e2a1b62520ee (patch)
treeb1d76f113410e9cf328b035b62aa176bce78524e
parentFix direction of fake edges (diff)
downloadsynapse-c772b35a257afaeb989a0c9b2690e2a1b62520ee.tar.xz
Implement backfill in handler so we can do fetching later
Old and new implementation seem to perform the same :)

```
old implementation backfill events=[
  "event_id=$BU66ZRqOvMEH-wRgx3hruEBKH1tcUUD0rWdGnUEAcuQ,depth=11,body=Message 1 (eventIDsAfter),prevs=['$r7UcvfwqKAnhqAesYovjSEWaC4aOcXWJMWQ0W7LhBok']",
  "event_id=$r7UcvfwqKAnhqAesYovjSEWaC4aOcXWJMWQ0W7LhBok,depth=10,body=Message 0 (eventIDsAfter),prevs=['$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA']",
  "event_id=$jX7MRv7WeXx79_r44I45EC8peZ0eKgbN12wolz0_ueA,depth=10,body=org.matrix.msc2716.insertion,prevs=['$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA']",
  "event_id=$HG6XjFmFFO5O2-JW-kaayz2qJTwhzrtICjHdV9j0RMU,depth=10,body=org.matrix.msc2716.batch,prevs=['$d-z0eDSnU4PhbnisRLC7OIvoQFXlfnwhElh5mA1gFFo']",
  "event_id=$d-z0eDSnU4PhbnisRLC7OIvoQFXlfnwhElh5mA1gFFo,depth=10,body=Historical 99 (batch=0),prevs=['$z8iHeSZupiT5NOYzhhyOEFwrPMFI3vN2iDFpijniw6Q']",
  "event_id=$z8iHeSZupiT5NOYzhhyOEFwrPMFI3vN2iDFpijniw6Q,depth=10,body=Historical 98 (batch=0),prevs=['$ddn3uR4QbOH8imNzXy-_xz9Kn63qAJhC9NjFOUvu-_w']",
  "event_id=$ddn3uR4QbOH8imNzXy-_xz9Kn63qAJhC9NjFOUvu-_w,depth=10,body=Historical 97 (batch=0),prevs=['$BRTaYbuvXTnBpC-Dhee2UUBY-LePaWLTMd60sa82c_I']",
  "event_id=$BRTaYbuvXTnBpC-Dhee2UUBY-LePaWLTMd60sa82c_I,depth=10,body=Historical 96 (batch=0),prevs=['$HC1catch1Ti3NWcGWWXJ7doMinWfU-SNkCYJC7v_RxA']",
  "event_id=$HC1catch1Ti3NWcGWWXJ7doMinWfU-SNkCYJC7v_RxA,depth=10,body=Historical 95 (batch=0),prevs=['$DL3D99BYS_Cn047L6XxUvHN86icB69Yi9jttmxnepVo']",
  "event_id=$DL3D99BYS_Cn047L6XxUvHN86icB69Yi9jttmxnepVo,depth=10,body=Historical 94 (batch=0),prevs=['$bqDvvvMj2a4x4FUh_Iy6aA9sejqunlPQxjgDhM9-2CY']",
  "event_id=$bqDvvvMj2a4x4FUh_Iy6aA9sejqunlPQxjgDhM9-2CY,depth=10,body=Historical 93 (batch=0),prevs=['$CUhTzLqLabAzjqNbh9_SKSX1Re7z581D7BF90a3jE-0']",
  "event_id=$CUhTzLqLabAzjqNbh9_SKSX1Re7z581D7BF90a3jE-0,depth=10,body=Historical 92 (batch=0),prevs=['$3l6A4siERlLreAmXGH1KFagDjb9G8i4_TrxLErZS4FY']",
  "event_id=$3l6A4siERlLreAmXGH1KFagDjb9G8i4_TrxLErZS4FY,depth=10,body=Historical 91 (batch=0),prevs=['$BSosTk20sS031k33sDi_kMkrGMVjSUnCzT1wvZo0dcg']",
  "event_id=$BSosTk20sS031k33sDi_kMkrGMVjSUnCzT1wvZo0dcg,depth=10,body=Historical 90 (batch=0),prevs=['$XoyyYG9ngSu_sJ_npwDgrwLVQt0E6kDAxW_f0MzaIKs']",
  "event_id=$XoyyYG9ngSu_sJ_npwDgrwLVQt0E6kDAxW_f0MzaIKs,depth=10,body=Historical 89 (batch=0),prevs=['$8j7g564Kma7kqrgkqru2Nw21Ez2xZoyqBXtgrwYtbIU']",
  "event_id=$8j7g564Kma7kqrgkqru2Nw21Ez2xZoyqBXtgrwYtbIU,depth=10,body=Historical 88 (batch=0),prevs=['$FlIO19qRDZggQ3ZIMd4OhF4kGNpiipB4BR7sqQnG5xU']",
  "event_id=$FlIO19qRDZggQ3ZIMd4OhF4kGNpiipB4BR7sqQnG5xU,depth=10,body=Historical 87 (batch=0),prevs=['$reiGLF3R8Q5wqm_KJKOTQGFQ6PHIExRrV1nmB7lw5WA']",
  "event_id=$reiGLF3R8Q5wqm_KJKOTQGFQ6PHIExRrV1nmB7lw5WA,depth=10,body=Historical 86 (batch=0),prevs=['$7JRXCFtNfXY_TNZTZSjr7dPnKAMz39E8K2DQfhrxk0s']",
  "event_id=$7JRXCFtNfXY_TNZTZSjr7dPnKAMz39E8K2DQfhrxk0s,depth=10,body=Historical 85 (batch=0),prevs=['$8Z6-6uE22VHh3KoN2wGa9SAPhf0_MXPz3y_O2G8A9Bo']",
  "event_id=$8Z6-6uE22VHh3KoN2wGa9SAPhf0_MXPz3y_O2G8A9Bo,depth=10,body=Historical 84 (batch=0),prevs=['$CETAr2-SIsfT_exUgUY9El4PL6WOFnr7_6Hv86BuZUQ']",
  "event_id=$CETAr2-SIsfT_exUgUY9El4PL6WOFnr7_6Hv86BuZUQ,depth=10,body=Historical 83 (batch=0),prevs=['$dMOfVXcWxuoNS9di9AHyocIzAAucNG2v2aXqZWK7oA0']",
  "event_id=$dMOfVXcWxuoNS9di9AHyocIzAAucNG2v2aXqZWK7oA0,depth=10,body=Historical 82 (batch=0),prevs=['$4UjX4-4EejV7e0umXczxoqx9eHMvu2fFDIPGlY4zdrQ']",
  "event_id=$4UjX4-4EejV7e0umXczxoqx9eHMvu2fFDIPGlY4zdrQ,depth=10,body=Historical 81 (batch=0),prevs=['$e5d87r41P1lFrfM8iEp3waCi21lKx-bFBTEMhUMDJhE']",
  "event_id=$e5d87r41P1lFrfM8iEp3waCi21lKx-bFBTEMhUMDJhE,depth=10,body=Historical 80 (batch=0),prevs=['$ez0-Q4agOvUQbWUELiTJEEJWwZYj-TnaQTnNc3Vil8M']",
  "event_id=$ez0-Q4agOvUQbWUELiTJEEJWwZYj-TnaQTnNc3Vil8M,depth=10,body=Historical 79 (batch=0),prevs=['$zaMM-ZtQMADqFNsjrQrl_u0FIjxVHSEbdICkI5kph14']",
  "event_id=$zaMM-ZtQMADqFNsjrQrl_u0FIjxVHSEbdICkI5kph14,depth=10,body=Historical 78 (batch=0),prevs=['$jhDwZ4C8aCS7xm0D7xwQYKYXxE9yrnV_jnXWs7yj97A']",
  "event_id=$jhDwZ4C8aCS7xm0D7xwQYKYXxE9yrnV_jnXWs7yj97A,depth=10,body=Historical 77 (batch=0),prevs=['$794zi7lECGaZqgi-mVDTuAcCVxQRcasLEWHNQk_T5Qo']",
  "event_id=$794zi7lECGaZqgi-mVDTuAcCVxQRcasLEWHNQk_T5Qo,depth=10,body=Historical 76 (batch=0),prevs=['$RYc7Epu2beVamNOISGEPPzYPnqNr8OPpy6srKUDCNaY']",
  "event_id=$RYc7Epu2beVamNOISGEPPzYPnqNr8OPpy6srKUDCNaY,depth=10,body=Historical 75 (batch=0),prevs=['$NxzF542rsM0WMKZonV9YxmaJ5PLpVWK1TUfcLFP4VT8']",
  "event_id=$NxzF542rsM0WMKZonV9YxmaJ5PLpVWK1TUfcLFP4VT8,depth=10,body=Historical 74 (batch=0),prevs=['$YbcfMO7DOlq6owFILKIGpLSrvpMiDmIp77TCmafFxUU']",
  "event_id=$YbcfMO7DOlq6owFILKIGpLSrvpMiDmIp77TCmafFxUU,depth=10,body=Historical 73 (batch=0),prevs=['$RmlFFGojIl8VSc115lgQwk0NeAIAQT7CuLv3ajIv2X0']",
  "event_id=$RmlFFGojIl8VSc115lgQwk0NeAIAQT7CuLv3ajIv2X0,depth=10,body=Historical 72 (batch=0),prevs=['$lGGzpQOPdmzBqXIFF5HZfyGQCmXJOnmkZCRFRzxqJkw']",
  "event_id=$lGGzpQOPdmzBqXIFF5HZfyGQCmXJOnmkZCRFRzxqJkw,depth=10,body=Historical 71 (batch=0),prevs=['$TcSzi68MSFf1W0843Zi0iRq5vXFs8FhdtI9NfNCY5DM']",
  "event_id=$TcSzi68MSFf1W0843Zi0iRq5vXFs8FhdtI9NfNCY5DM,depth=10,body=Historical 70 (batch=0),prevs=['$iKaFgZ_aeN-ZJUNJEYj4WjY31RPm8PXs27n-u2LnlCE']",
  "event_id=$iKaFgZ_aeN-ZJUNJEYj4WjY31RPm8PXs27n-u2LnlCE,depth=10,body=Historical 69 (batch=0),prevs=['$n52R-hna5danKau87AHkwXDV5CuUTIZ960gtHr9X8hw']",
  "event_id=$n52R-hna5danKau87AHkwXDV5CuUTIZ960gtHr9X8hw,depth=10,body=Historical 68 (batch=0),prevs=['$Fr3wnWXII8LpE3VyF1pLWuLpSCyxu7jC1i4ggMqH1kE']",
  "event_id=$Fr3wnWXII8LpE3VyF1pLWuLpSCyxu7jC1i4ggMqH1kE,depth=10,body=Historical 67 (batch=0),prevs=['$ebCIN2TL4fFQeTEahzeX-VCkh_YEohAItvRd6LAVP2E']",
  "event_id=$ebCIN2TL4fFQeTEahzeX-VCkh_YEohAItvRd6LAVP2E,depth=10,body=Historical 66 (batch=0),prevs=['$CFeaKxHxgPCSUufJChertFT4au4P9Y1a_tTdN2wmo3Q']",
  "event_id=$CFeaKxHxgPCSUufJChertFT4au4P9Y1a_tTdN2wmo3Q,depth=10,body=Historical 65 (batch=0),prevs=['$MctpfuMG5AhhCb9aPRG-4V6VKxxNUzALNLq3BVJKejU']",
  "event_id=$MctpfuMG5AhhCb9aPRG-4V6VKxxNUzALNLq3BVJKejU,depth=10,body=Historical 64 (batch=0),prevs=['$ikjtTCZ7KXg1qtwgURuBZ-P5C1RG1oY8U3k2rm9RGxA']",
  "event_id=$ikjtTCZ7KXg1qtwgURuBZ-P5C1RG1oY8U3k2rm9RGxA,depth=10,body=Historical 63 (batch=0),prevs=['$KDbI-rBuoAI7rRhtAjcoDY2PbLQ9gDsK5fRts3OihSA']",
  "event_id=$KDbI-rBuoAI7rRhtAjcoDY2PbLQ9gDsK5fRts3OihSA,depth=10,body=Historical 62 (batch=0),prevs=['$_ZwqRJxNwgcZn4Trb5nrTjRP8ssQuLDq5ThguCm9KzE']",
  "event_id=$_ZwqRJxNwgcZn4Trb5nrTjRP8ssQuLDq5ThguCm9KzE,depth=10,body=Historical 61 (batch=0),prevs=['$hq1xDHEWodibkwlNg73931wjYlD5M29dkFHU0dQB2dk']",
  "event_id=$hq1xDHEWodibkwlNg73931wjYlD5M29dkFHU0dQB2dk,depth=10,body=Historical 60 (batch=0),prevs=['$XPRt_CuI_AXJylRQYbQ0ItkRkMy4ey0XxqS7iIdGLfQ']",
  "event_id=$XPRt_CuI_AXJylRQYbQ0ItkRkMy4ey0XxqS7iIdGLfQ,depth=10,body=Historical 59 (batch=0),prevs=['$Ucd44nYFkYVe_zs5wEqU5slG74IIPdzq_mqEHinIoIo']",
  "event_id=$Ucd44nYFkYVe_zs5wEqU5slG74IIPdzq_mqEHinIoIo,depth=10,body=Historical 58 (batch=0),prevs=['$CtM1TqWoFt3KabPNRKYi1vrpOPGwdpjx-15TpfKgYYA']",
  "event_id=$CtM1TqWoFt3KabPNRKYi1vrpOPGwdpjx-15TpfKgYYA,depth=10,body=Historical 57 (batch=0),prevs=['$Jo8T-m9nSs77uF4uFtkd22CifwnvDlr13Fs14NHcCMw']",
  "event_id=$Jo8T-m9nSs77uF4uFtkd22CifwnvDlr13Fs14NHcCMw,depth=10,body=Historical 56 (batch=0),prevs=['$WW45KevKriYRET0tOmKk8Ha9fFqxJJS_IC8Ih6I3L2A']",
  "event_id=$WW45KevKriYRET0tOmKk8Ha9fFqxJJS_IC8Ih6I3L2A,depth=10,body=Historical 55 (batch=0),prevs=['$G60oGyHZvp-Gim48qnC_epu2JRseKQUCTI5vqZEIbaI']",
  "event_id=$G60oGyHZvp-Gim48qnC_epu2JRseKQUCTI5vqZEIbaI,depth=10,body=Historical 54 (batch=0),prevs=['$R9Z6YaR1K9ulUzF9d6-ZL0QwJmwaEj1wTUPHrTJqFUs']",
  "event_id=$R9Z6YaR1K9ulUzF9d6-ZL0QwJmwaEj1wTUPHrTJqFUs,depth=10,body=Historical 53 (batch=0),prevs=['$CqedFlSaUBYWSHtkJJYmoc-DnxWCAaKVKOai0u5rawM']",
  "event_id=$CqedFlSaUBYWSHtkJJYmoc-DnxWCAaKVKOai0u5rawM,depth=10,body=Historical 52 (batch=0),prevs=['$3Ol33IgZ5lBuVwgELhRBYoFLb6GwkFTha3j6uxvHToY']",
  "event_id=$3Ol33IgZ5lBuVwgELhRBYoFLb6GwkFTha3j6uxvHToY,depth=10,body=Historical 51 (batch=0),prevs=['$wUcLTd2pGhliQunqWxFGvT6yiEZrUXA920-hcjaloSw']",
  "event_id=$wUcLTd2pGhliQunqWxFGvT6yiEZrUXA920-hcjaloSw,depth=10,body=Historical 50 (batch=0),prevs=['$gaO95ghwbwpGttuqBbhMrZJzz9Z440U7L2WOtDy7Hr8']",
  "event_id=$gaO95ghwbwpGttuqBbhMrZJzz9Z440U7L2WOtDy7Hr8,depth=10,body=Historical 49 (batch=0),prevs=['$4TSr_VvZzCV17JYxAob3DN2nQiYDqgW2S_QkW27v7Bg']",
  "event_id=$4TSr_VvZzCV17JYxAob3DN2nQiYDqgW2S_QkW27v7Bg,depth=10,body=Historical 48 (batch=0),prevs=['$bJaLResm_4aAwSjZ0POTvtVx4lnV9HKt8HwiYgP21lM']",
  "event_id=$bJaLResm_4aAwSjZ0POTvtVx4lnV9HKt8HwiYgP21lM,depth=10,body=Historical 47 (batch=0),prevs=['$BouN8LDmbFWiWo9Wc4wQi48YsC-icXewa05KR7byzhM']",
  "event_id=$BouN8LDmbFWiWo9Wc4wQi48YsC-icXewa05KR7byzhM,depth=10,body=Historical 46 (batch=0),prevs=['$n9Cv6EUu7i25OZLCllOE2PU4xjRthDKhkdtp5OtMuVk']",
  "event_id=$n9Cv6EUu7i25OZLCllOE2PU4xjRthDKhkdtp5OtMuVk,depth=10,body=Historical 45 (batch=0),prevs=['$MLVpmxVSSRRpxlcTkwIJT3neo7maqOp_ZLvwXRBY8A8']",
  "event_id=$MLVpmxVSSRRpxlcTkwIJT3neo7maqOp_ZLvwXRBY8A8,depth=10,body=Historical 44 (batch=0),prevs=['$tNv8Se5-lgfW-9MqE_upeBzq3QSPpsn7qOHz49WFs_c']",
  "event_id=$tNv8Se5-lgfW-9MqE_upeBzq3QSPpsn7qOHz49WFs_c,depth=10,body=Historical 43 (batch=0),prevs=['$XCDKybStk9PsquzrY-biUlKOmjk3wTXnsD1htiMdgAM']",
  "event_id=$XCDKybStk9PsquzrY-biUlKOmjk3wTXnsD1htiMdgAM,depth=10,body=Historical 42 (batch=0),prevs=['$iUDAE7nT6DQaNJSemwUpqQs8KvKTPFexcBJLTs2-gnY']",
  "event_id=$iUDAE7nT6DQaNJSemwUpqQs8KvKTPFexcBJLTs2-gnY,depth=10,body=Historical 41 (batch=0),prevs=['$T8NTrB9vQMLW-a0tT3corPl0g6O3UjGIoaHBjkjCD_w']",
  "event_id=$T8NTrB9vQMLW-a0tT3corPl0g6O3UjGIoaHBjkjCD_w,depth=10,body=Historical 40 (batch=0),prevs=['$N7jCLhKYDejMTejtrjJfM2lMRES5OPeowtvN-L4utsE']",
  "event_id=$N7jCLhKYDejMTejtrjJfM2lMRES5OPeowtvN-L4utsE,depth=10,body=Historical 39 (batch=0),prevs=['$Oy9aTfjL0LSnbF_6MRq7-5baaEbfxyRTK1kbVGeNoaU']",
  "event_id=$Oy9aTfjL0LSnbF_6MRq7-5baaEbfxyRTK1kbVGeNoaU,depth=10,body=Historical 38 (batch=0),prevs=['$V4qFDnqO1LrboSWwCoQpQ4dXLyrc74qZbbsaHxqAj4Q']",
  "event_id=$V4qFDnqO1LrboSWwCoQpQ4dXLyrc74qZbbsaHxqAj4Q,depth=10,body=Historical 37 (batch=0),prevs=['$vWdLNDGwj_mBJ6JZ2s01OhsxRuPNSSJAM_bMa6J9Q2c']",
  "event_id=$vWdLNDGwj_mBJ6JZ2s01OhsxRuPNSSJAM_bMa6J9Q2c,depth=10,body=Historical 36 (batch=0),prevs=['$JZt2EdPtKJX6f2MMbj_gSEseVAMa-H5r_J_yvfhHs5k']",
  "event_id=$JZt2EdPtKJX6f2MMbj_gSEseVAMa-H5r_J_yvfhHs5k,depth=10,body=Historical 35 (batch=0),prevs=['$NPzUfUgNfvkezhUeLmcp2utVA_XnW8YzDqbZlznsEN0']",
  "event_id=$NPzUfUgNfvkezhUeLmcp2utVA_XnW8YzDqbZlznsEN0,depth=10,body=Historical 34 (batch=0),prevs=['$NNUjzVtvOSFDYRID_PsMJrUC8gx5p1mPvIoMB7ibDn0']",
  "event_id=$NNUjzVtvOSFDYRID_PsMJrUC8gx5p1mPvIoMB7ibDn0,depth=10,body=Historical 33 (batch=0),prevs=['$dONbCTAYR0kOMVSmxOnM5aQ4bgx9PbKza98_e2Lxxw4']",
  "event_id=$dONbCTAYR0kOMVSmxOnM5aQ4bgx9PbKza98_e2Lxxw4,depth=10,body=Historical 32 (batch=0),prevs=['$dwxZHePgzbtQMO3caex0O9Zdl-gT3fpWRZD5dJ43JmE']",
  "event_id=$dwxZHePgzbtQMO3caex0O9Zdl-gT3fpWRZD5dJ43JmE,depth=10,body=Historical 31 (batch=0),prevs=['$5JOpa9222Y0__S8yfaZBT7ESuRaPeeRz80jleMoa5hE']",
  "event_id=$5JOpa9222Y0__S8yfaZBT7ESuRaPeeRz80jleMoa5hE,depth=10,body=Historical 30 (batch=0),prevs=['$7yIEFZZFs91wjKScsjbG854DUOqomPnV4iGG-EDWK6w']",
  "event_id=$7yIEFZZFs91wjKScsjbG854DUOqomPnV4iGG-EDWK6w,depth=10,body=Historical 29 (batch=0),prevs=['$9pzIrDRB1cuweDiHaPGB6AtTtGeGEOmqyoP59UAa0pI']",
  "event_id=$9pzIrDRB1cuweDiHaPGB6AtTtGeGEOmqyoP59UAa0pI,depth=10,body=Historical 28 (batch=0),prevs=['$EBu0Y6-OdqNUumOlHK__K2eXsN8mAYV21eCRKwGmkxU']",
  "event_id=$EBu0Y6-OdqNUumOlHK__K2eXsN8mAYV21eCRKwGmkxU,depth=10,body=Historical 27 (batch=0),prevs=['$95FzYeNZk31wyfaCojognGOAkzLhHLrv4_j3eoJawwU']",
  "event_id=$95FzYeNZk31wyfaCojognGOAkzLhHLrv4_j3eoJawwU,depth=10,body=Historical 26 (batch=0),prevs=['$QDGDnSNRXjNZG2lia2gjeD1aEfgfZ0gxI1BzIgjyZq8']",
  "event_id=$QDGDnSNRXjNZG2lia2gjeD1aEfgfZ0gxI1BzIgjyZq8,depth=10,body=Historical 25 (batch=0),prevs=['$tf1GB8ydPyNTNAaGwcTUXaTOSCmNohK6e6MmOnFwrJA']",
  "event_id=$tf1GB8ydPyNTNAaGwcTUXaTOSCmNohK6e6MmOnFwrJA,depth=10,body=Historical 24 (batch=0),prevs=['$n40ks3dofH6DioQlfe84n3exnYrboy8GHHYJ_qBFJMg']",
  "event_id=$n40ks3dofH6DioQlfe84n3exnYrboy8GHHYJ_qBFJMg,depth=10,body=Historical 23 (batch=0),prevs=['$xl8xG3MJiiNP21WNFmDLxOR8Rhy_FLws0snsmDUoAYQ']",
  "event_id=$xl8xG3MJiiNP21WNFmDLxOR8Rhy_FLws0snsmDUoAYQ,depth=10,body=Historical 22 (batch=0),prevs=['$6MxFONk8t5shoQpjjZyxd0ypmfj76LPs9hWKkPAxMcI']",
  "event_id=$6MxFONk8t5shoQpjjZyxd0ypmfj76LPs9hWKkPAxMcI,depth=10,body=Historical 21 (batch=0),prevs=['$XAAn4gMQe4ShIZKvZntEUBRljDM4IxHDVeNOXp3K2Bk']",
  "event_id=$XAAn4gMQe4ShIZKvZntEUBRljDM4IxHDVeNOXp3K2Bk,depth=10,body=Historical 20 (batch=0),prevs=['$Gj3RlKLUMb6hI_JyXdfwuoneWDs1b63qF7WdYYiNDG0']",
  "event_id=$Gj3RlKLUMb6hI_JyXdfwuoneWDs1b63qF7WdYYiNDG0,depth=10,body=Historical 19 (batch=0),prevs=['$yiRe3l3_APWuZt1wfFBxXQp2orQJZJvwv3yk4QNiPxo']",
  "event_id=$yiRe3l3_APWuZt1wfFBxXQp2orQJZJvwv3yk4QNiPxo,depth=10,body=Historical 18 (batch=0),prevs=['$v04Ud2zPqFe5M3jPbiLrqQ6r_QXgFlmRTMMLyVvAsN8']",
  "event_id=$v04Ud2zPqFe5M3jPbiLrqQ6r_QXgFlmRTMMLyVvAsN8,depth=10,body=Historical 17 (batch=0),prevs=['$tO5NiLH2mPBIMRVmrTIza6CUv7v6R0e_tgj0ZKEtpG0']",
  "event_id=$tO5NiLH2mPBIMRVmrTIza6CUv7v6R0e_tgj0ZKEtpG0,depth=10,body=Historical 16 (batch=0),prevs=['$fyQ-akREpz3vpQNqTZ47yxAs_APAw2L_bQ1iAudsPWk']",
  "event_id=$fyQ-akREpz3vpQNqTZ47yxAs_APAw2L_bQ1iAudsPWk,depth=10,body=Historical 15 (batch=0),prevs=['$qddW2HRZA0BudaIWuun6Odt6wDbz7ETRJmSY8wtjMnY']",
  "event_id=$qddW2HRZA0BudaIWuun6Odt6wDbz7ETRJmSY8wtjMnY,depth=10,body=Historical 14 (batch=0),prevs=['$fxl98r0B-sa2T8LDR2q6Wi01Zw6xCPZB5FcMf5x_vxI']",
  "event_id=$fxl98r0B-sa2T8LDR2q6Wi01Zw6xCPZB5FcMf5x_vxI,depth=10,body=Historical 13 (batch=0),prevs=['$1PML_QTo1MK_EuUz3OYyc2vDjfGKKYt-0sUSN9jTeHs']",
  "event_id=$1PML_QTo1MK_EuUz3OYyc2vDjfGKKYt-0sUSN9jTeHs,depth=10,body=Historical 12 (batch=0),prevs=['$YTz-q29BhUU_Ox7_CR7gao1v7mmMqLwbz51WWI0CjHs']",
  "event_id=$YTz-q29BhUU_Ox7_CR7gao1v7mmMqLwbz51WWI0CjHs,depth=10,body=Historical 11 (batch=0),prevs=['$Y3HUk4SiCWUrV5V_ZUcwC1IkVZEPM3V8oGWrWKRcv3I']",
  "event_id=$Y3HUk4SiCWUrV5V_ZUcwC1IkVZEPM3V8oGWrWKRcv3I,depth=10,body=Historical 10 (batch=0),prevs=['$uV5daep6tIdbImy2XEIxdQIuGYc547ulzxMplDyBWfY']",
  "event_id=$uV5daep6tIdbImy2XEIxdQIuGYc547ulzxMplDyBWfY,depth=10,body=Historical 9 (batch=0),prevs=['$bVKZ6uRROzC7aNcZc9cUsfhHl5dU_-Vm6Qz5V9X8GsI']",
  "event_id=$bVKZ6uRROzC7aNcZc9cUsfhHl5dU_-Vm6Qz5V9X8GsI,depth=10,body=Historical 8 (batch=0),prevs=['$6zjql7LGgIa3gFpf9owZsKWeFU4FoMUKDtVPpMo7xsM']",
  "event_id=$6zjql7LGgIa3gFpf9owZsKWeFU4FoMUKDtVPpMo7xsM,depth=10,body=Historical 7 (batch=0),prevs=['$w5t7UuOHrrsfZRebkX4adeEeJpPPGv9y6RyhKpxToMc']",
  "event_id=$w5t7UuOHrrsfZRebkX4adeEeJpPPGv9y6RyhKpxToMc,depth=10,body=Historical 6 (batch=0),prevs=['$649goNxH4B0DMta75_xs_TTib6C268A2JiUHvpUMu8g']",
  "event_id=$649goNxH4B0DMta75_xs_TTib6C268A2JiUHvpUMu8g,depth=10,body=Historical 5 (batch=0),prevs=['$mtUwpP0KSNwsn73yxBfQ7imKUe955v_SvI427PC5y2I']",
  "event_id=$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA,depth=9,body=Message 1 (eventIDsBefore),prevs=['$FcPmU5Fjg57eO_2J4VOK9jOcqRclEED5B9i1FsHNjaE']\"
]
```

```
new implementation backfill events=[
  "event_id=$BU66ZRqOvMEH-wRgx3hruEBKH1tcUUD0rWdGnUEAcuQ,depth=11,body=Message 1 (eventIDsAfter),prevs=['$r7UcvfwqKAnhqAesYovjSEWaC4aOcXWJMWQ0W7LhBok']",
  "event_id=$r7UcvfwqKAnhqAesYovjSEWaC4aOcXWJMWQ0W7LhBok,depth=10,body=Message 0 (eventIDsAfter),prevs=['$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA']",
  "event_id=$jX7MRv7WeXx79_r44I45EC8peZ0eKgbN12wolz0_ueA,depth=10,body=org.matrix.msc2716.insertion,prevs=['$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA']",
  "event_id=$HG6XjFmFFO5O2-JW-kaayz2qJTwhzrtICjHdV9j0RMU,depth=10,body=org.matrix.msc2716.batch,prevs=['$d-z0eDSnU4PhbnisRLC7OIvoQFXlfnwhElh5mA1gFFo']",
  "event_id=$d-z0eDSnU4PhbnisRLC7OIvoQFXlfnwhElh5mA1gFFo,depth=10,body=Historical 99 (batch=0),prevs=['$z8iHeSZupiT5NOYzhhyOEFwrPMFI3vN2iDFpijniw6Q']",
  "event_id=$z8iHeSZupiT5NOYzhhyOEFwrPMFI3vN2iDFpijniw6Q,depth=10,body=Historical 98 (batch=0),prevs=['$ddn3uR4QbOH8imNzXy-_xz9Kn63qAJhC9NjFOUvu-_w']",
  "event_id=$ddn3uR4QbOH8imNzXy-_xz9Kn63qAJhC9NjFOUvu-_w,depth=10,body=Historical 97 (batch=0),prevs=['$BRTaYbuvXTnBpC-Dhee2UUBY-LePaWLTMd60sa82c_I']",
  "event_id=$BRTaYbuvXTnBpC-Dhee2UUBY-LePaWLTMd60sa82c_I,depth=10,body=Historical 96 (batch=0),prevs=['$HC1catch1Ti3NWcGWWXJ7doMinWfU-SNkCYJC7v_RxA']",
  "event_id=$HC1catch1Ti3NWcGWWXJ7doMinWfU-SNkCYJC7v_RxA,depth=10,body=Historical 95 (batch=0),prevs=['$DL3D99BYS_Cn047L6XxUvHN86icB69Yi9jttmxnepVo']",
  "event_id=$DL3D99BYS_Cn047L6XxUvHN86icB69Yi9jttmxnepVo,depth=10,body=Historical 94 (batch=0),prevs=['$bqDvvvMj2a4x4FUh_Iy6aA9sejqunlPQxjgDhM9-2CY']",
  "event_id=$bqDvvvMj2a4x4FUh_Iy6aA9sejqunlPQxjgDhM9-2CY,depth=10,body=Historical 93 (batch=0),prevs=['$CUhTzLqLabAzjqNbh9_SKSX1Re7z581D7BF90a3jE-0']",
  "event_id=$CUhTzLqLabAzjqNbh9_SKSX1Re7z581D7BF90a3jE-0,depth=10,body=Historical 92 (batch=0),prevs=['$3l6A4siERlLreAmXGH1KFagDjb9G8i4_TrxLErZS4FY']",
  "event_id=$3l6A4siERlLreAmXGH1KFagDjb9G8i4_TrxLErZS4FY,depth=10,body=Historical 91 (batch=0),prevs=['$BSosTk20sS031k33sDi_kMkrGMVjSUnCzT1wvZo0dcg']",
  "event_id=$BSosTk20sS031k33sDi_kMkrGMVjSUnCzT1wvZo0dcg,depth=10,body=Historical 90 (batch=0),prevs=['$XoyyYG9ngSu_sJ_npwDgrwLVQt0E6kDAxW_f0MzaIKs']",
  "event_id=$XoyyYG9ngSu_sJ_npwDgrwLVQt0E6kDAxW_f0MzaIKs,depth=10,body=Historical 89 (batch=0),prevs=['$8j7g564Kma7kqrgkqru2Nw21Ez2xZoyqBXtgrwYtbIU']",
  "event_id=$8j7g564Kma7kqrgkqru2Nw21Ez2xZoyqBXtgrwYtbIU,depth=10,body=Historical 88 (batch=0),prevs=['$FlIO19qRDZggQ3ZIMd4OhF4kGNpiipB4BR7sqQnG5xU']",
  "event_id=$FlIO19qRDZggQ3ZIMd4OhF4kGNpiipB4BR7sqQnG5xU,depth=10,body=Historical 87 (batch=0),prevs=['$reiGLF3R8Q5wqm_KJKOTQGFQ6PHIExRrV1nmB7lw5WA']",
  "event_id=$reiGLF3R8Q5wqm_KJKOTQGFQ6PHIExRrV1nmB7lw5WA,depth=10,body=Historical 86 (batch=0),prevs=['$7JRXCFtNfXY_TNZTZSjr7dPnKAMz39E8K2DQfhrxk0s']",
  "event_id=$7JRXCFtNfXY_TNZTZSjr7dPnKAMz39E8K2DQfhrxk0s,depth=10,body=Historical 85 (batch=0),prevs=['$8Z6-6uE22VHh3KoN2wGa9SAPhf0_MXPz3y_O2G8A9Bo']",
  "event_id=$8Z6-6uE22VHh3KoN2wGa9SAPhf0_MXPz3y_O2G8A9Bo,depth=10,body=Historical 84 (batch=0),prevs=['$CETAr2-SIsfT_exUgUY9El4PL6WOFnr7_6Hv86BuZUQ']",
  "event_id=$CETAr2-SIsfT_exUgUY9El4PL6WOFnr7_6Hv86BuZUQ,depth=10,body=Historical 83 (batch=0),prevs=['$dMOfVXcWxuoNS9di9AHyocIzAAucNG2v2aXqZWK7oA0']",
  "event_id=$dMOfVXcWxuoNS9di9AHyocIzAAucNG2v2aXqZWK7oA0,depth=10,body=Historical 82 (batch=0),prevs=['$4UjX4-4EejV7e0umXczxoqx9eHMvu2fFDIPGlY4zdrQ']",
  "event_id=$4UjX4-4EejV7e0umXczxoqx9eHMvu2fFDIPGlY4zdrQ,depth=10,body=Historical 81 (batch=0),prevs=['$e5d87r41P1lFrfM8iEp3waCi21lKx-bFBTEMhUMDJhE']",
  "event_id=$e5d87r41P1lFrfM8iEp3waCi21lKx-bFBTEMhUMDJhE,depth=10,body=Historical 80 (batch=0),prevs=['$ez0-Q4agOvUQbWUELiTJEEJWwZYj-TnaQTnNc3Vil8M']",
  "event_id=$ez0-Q4agOvUQbWUELiTJEEJWwZYj-TnaQTnNc3Vil8M,depth=10,body=Historical 79 (batch=0),prevs=['$zaMM-ZtQMADqFNsjrQrl_u0FIjxVHSEbdICkI5kph14']",
  "event_id=$zaMM-ZtQMADqFNsjrQrl_u0FIjxVHSEbdICkI5kph14,depth=10,body=Historical 78 (batch=0),prevs=['$jhDwZ4C8aCS7xm0D7xwQYKYXxE9yrnV_jnXWs7yj97A']",
  "event_id=$jhDwZ4C8aCS7xm0D7xwQYKYXxE9yrnV_jnXWs7yj97A,depth=10,body=Historical 77 (batch=0),prevs=['$794zi7lECGaZqgi-mVDTuAcCVxQRcasLEWHNQk_T5Qo']",
  "event_id=$794zi7lECGaZqgi-mVDTuAcCVxQRcasLEWHNQk_T5Qo,depth=10,body=Historical 76 (batch=0),prevs=['$RYc7Epu2beVamNOISGEPPzYPnqNr8OPpy6srKUDCNaY']",
  "event_id=$RYc7Epu2beVamNOISGEPPzYPnqNr8OPpy6srKUDCNaY,depth=10,body=Historical 75 (batch=0),prevs=['$NxzF542rsM0WMKZonV9YxmaJ5PLpVWK1TUfcLFP4VT8']",
  "event_id=$NxzF542rsM0WMKZonV9YxmaJ5PLpVWK1TUfcLFP4VT8,depth=10,body=Historical 74 (batch=0),prevs=['$YbcfMO7DOlq6owFILKIGpLSrvpMiDmIp77TCmafFxUU']",
  "event_id=$YbcfMO7DOlq6owFILKIGpLSrvpMiDmIp77TCmafFxUU,depth=10,body=Historical 73 (batch=0),prevs=['$RmlFFGojIl8VSc115lgQwk0NeAIAQT7CuLv3ajIv2X0']",
  "event_id=$RmlFFGojIl8VSc115lgQwk0NeAIAQT7CuLv3ajIv2X0,depth=10,body=Historical 72 (batch=0),prevs=['$lGGzpQOPdmzBqXIFF5HZfyGQCmXJOnmkZCRFRzxqJkw']",
  "event_id=$lGGzpQOPdmzBqXIFF5HZfyGQCmXJOnmkZCRFRzxqJkw,depth=10,body=Historical 71 (batch=0),prevs=['$TcSzi68MSFf1W0843Zi0iRq5vXFs8FhdtI9NfNCY5DM']",
  "event_id=$TcSzi68MSFf1W0843Zi0iRq5vXFs8FhdtI9NfNCY5DM,depth=10,body=Historical 70 (batch=0),prevs=['$iKaFgZ_aeN-ZJUNJEYj4WjY31RPm8PXs27n-u2LnlCE']",
  "event_id=$iKaFgZ_aeN-ZJUNJEYj4WjY31RPm8PXs27n-u2LnlCE,depth=10,body=Historical 69 (batch=0),prevs=['$n52R-hna5danKau87AHkwXDV5CuUTIZ960gtHr9X8hw']",
  "event_id=$n52R-hna5danKau87AHkwXDV5CuUTIZ960gtHr9X8hw,depth=10,body=Historical 68 (batch=0),prevs=['$Fr3wnWXII8LpE3VyF1pLWuLpSCyxu7jC1i4ggMqH1kE']",
  "event_id=$Fr3wnWXII8LpE3VyF1pLWuLpSCyxu7jC1i4ggMqH1kE,depth=10,body=Historical 67 (batch=0),prevs=['$ebCIN2TL4fFQeTEahzeX-VCkh_YEohAItvRd6LAVP2E']",
  "event_id=$ebCIN2TL4fFQeTEahzeX-VCkh_YEohAItvRd6LAVP2E,depth=10,body=Historical 66 (batch=0),prevs=['$CFeaKxHxgPCSUufJChertFT4au4P9Y1a_tTdN2wmo3Q']",
  "event_id=$CFeaKxHxgPCSUufJChertFT4au4P9Y1a_tTdN2wmo3Q,depth=10,body=Historical 65 (batch=0),prevs=['$MctpfuMG5AhhCb9aPRG-4V6VKxxNUzALNLq3BVJKejU']",
  "event_id=$MctpfuMG5AhhCb9aPRG-4V6VKxxNUzALNLq3BVJKejU,depth=10,body=Historical 64 (batch=0),prevs=['$ikjtTCZ7KXg1qtwgURuBZ-P5C1RG1oY8U3k2rm9RGxA']",
  "event_id=$ikjtTCZ7KXg1qtwgURuBZ-P5C1RG1oY8U3k2rm9RGxA,depth=10,body=Historical 63 (batch=0),prevs=['$KDbI-rBuoAI7rRhtAjcoDY2PbLQ9gDsK5fRts3OihSA']",
  "event_id=$KDbI-rBuoAI7rRhtAjcoDY2PbLQ9gDsK5fRts3OihSA,depth=10,body=Historical 62 (batch=0),prevs=['$_ZwqRJxNwgcZn4Trb5nrTjRP8ssQuLDq5ThguCm9KzE']",
  "event_id=$_ZwqRJxNwgcZn4Trb5nrTjRP8ssQuLDq5ThguCm9KzE,depth=10,body=Historical 61 (batch=0),prevs=['$hq1xDHEWodibkwlNg73931wjYlD5M29dkFHU0dQB2dk']",
  "event_id=$hq1xDHEWodibkwlNg73931wjYlD5M29dkFHU0dQB2dk,depth=10,body=Historical 60 (batch=0),prevs=['$XPRt_CuI_AXJylRQYbQ0ItkRkMy4ey0XxqS7iIdGLfQ']",
  "event_id=$XPRt_CuI_AXJylRQYbQ0ItkRkMy4ey0XxqS7iIdGLfQ,depth=10,body=Historical 59 (batch=0),prevs=['$Ucd44nYFkYVe_zs5wEqU5slG74IIPdzq_mqEHinIoIo']",
  "event_id=$Ucd44nYFkYVe_zs5wEqU5slG74IIPdzq_mqEHinIoIo,depth=10,body=Historical 58 (batch=0),prevs=['$CtM1TqWoFt3KabPNRKYi1vrpOPGwdpjx-15TpfKgYYA']",
  "event_id=$CtM1TqWoFt3KabPNRKYi1vrpOPGwdpjx-15TpfKgYYA,depth=10,body=Historical 57 (batch=0),prevs=['$Jo8T-m9nSs77uF4uFtkd22CifwnvDlr13Fs14NHcCMw']",
  "event_id=$Jo8T-m9nSs77uF4uFtkd22CifwnvDlr13Fs14NHcCMw,depth=10,body=Historical 56 (batch=0),prevs=['$WW45KevKriYRET0tOmKk8Ha9fFqxJJS_IC8Ih6I3L2A']",
  "event_id=$WW45KevKriYRET0tOmKk8Ha9fFqxJJS_IC8Ih6I3L2A,depth=10,body=Historical 55 (batch=0),prevs=['$G60oGyHZvp-Gim48qnC_epu2JRseKQUCTI5vqZEIbaI']",
  "event_id=$G60oGyHZvp-Gim48qnC_epu2JRseKQUCTI5vqZEIbaI,depth=10,body=Historical 54 (batch=0),prevs=['$R9Z6YaR1K9ulUzF9d6-ZL0QwJmwaEj1wTUPHrTJqFUs']",
  "event_id=$R9Z6YaR1K9ulUzF9d6-ZL0QwJmwaEj1wTUPHrTJqFUs,depth=10,body=Historical 53 (batch=0),prevs=['$CqedFlSaUBYWSHtkJJYmoc-DnxWCAaKVKOai0u5rawM']",
  "event_id=$CqedFlSaUBYWSHtkJJYmoc-DnxWCAaKVKOai0u5rawM,depth=10,body=Historical 52 (batch=0),prevs=['$3Ol33IgZ5lBuVwgELhRBYoFLb6GwkFTha3j6uxvHToY']",
  "event_id=$3Ol33IgZ5lBuVwgELhRBYoFLb6GwkFTha3j6uxvHToY,depth=10,body=Historical 51 (batch=0),prevs=['$wUcLTd2pGhliQunqWxFGvT6yiEZrUXA920-hcjaloSw']",
  "event_id=$wUcLTd2pGhliQunqWxFGvT6yiEZrUXA920-hcjaloSw,depth=10,body=Historical 50 (batch=0),prevs=['$gaO95ghwbwpGttuqBbhMrZJzz9Z440U7L2WOtDy7Hr8']",
  "event_id=$gaO95ghwbwpGttuqBbhMrZJzz9Z440U7L2WOtDy7Hr8,depth=10,body=Historical 49 (batch=0),prevs=['$4TSr_VvZzCV17JYxAob3DN2nQiYDqgW2S_QkW27v7Bg']",
  "event_id=$4TSr_VvZzCV17JYxAob3DN2nQiYDqgW2S_QkW27v7Bg,depth=10,body=Historical 48 (batch=0),prevs=['$bJaLResm_4aAwSjZ0POTvtVx4lnV9HKt8HwiYgP21lM']",
  "event_id=$bJaLResm_4aAwSjZ0POTvtVx4lnV9HKt8HwiYgP21lM,depth=10,body=Historical 47 (batch=0),prevs=['$BouN8LDmbFWiWo9Wc4wQi48YsC-icXewa05KR7byzhM']",
  "event_id=$BouN8LDmbFWiWo9Wc4wQi48YsC-icXewa05KR7byzhM,depth=10,body=Historical 46 (batch=0),prevs=['$n9Cv6EUu7i25OZLCllOE2PU4xjRthDKhkdtp5OtMuVk']",
  "event_id=$n9Cv6EUu7i25OZLCllOE2PU4xjRthDKhkdtp5OtMuVk,depth=10,body=Historical 45 (batch=0),prevs=['$MLVpmxVSSRRpxlcTkwIJT3neo7maqOp_ZLvwXRBY8A8']",
  "event_id=$MLVpmxVSSRRpxlcTkwIJT3neo7maqOp_ZLvwXRBY8A8,depth=10,body=Historical 44 (batch=0),prevs=['$tNv8Se5-lgfW-9MqE_upeBzq3QSPpsn7qOHz49WFs_c']",
  "event_id=$tNv8Se5-lgfW-9MqE_upeBzq3QSPpsn7qOHz49WFs_c,depth=10,body=Historical 43 (batch=0),prevs=['$XCDKybStk9PsquzrY-biUlKOmjk3wTXnsD1htiMdgAM']",
  "event_id=$XCDKybStk9PsquzrY-biUlKOmjk3wTXnsD1htiMdgAM,depth=10,body=Historical 42 (batch=0),prevs=['$iUDAE7nT6DQaNJSemwUpqQs8KvKTPFexcBJLTs2-gnY']",
  "event_id=$iUDAE7nT6DQaNJSemwUpqQs8KvKTPFexcBJLTs2-gnY,depth=10,body=Historical 41 (batch=0),prevs=['$T8NTrB9vQMLW-a0tT3corPl0g6O3UjGIoaHBjkjCD_w']",
  "event_id=$T8NTrB9vQMLW-a0tT3corPl0g6O3UjGIoaHBjkjCD_w,depth=10,body=Historical 40 (batch=0),prevs=['$N7jCLhKYDejMTejtrjJfM2lMRES5OPeowtvN-L4utsE']",
  "event_id=$N7jCLhKYDejMTejtrjJfM2lMRES5OPeowtvN-L4utsE,depth=10,body=Historical 39 (batch=0),prevs=['$Oy9aTfjL0LSnbF_6MRq7-5baaEbfxyRTK1kbVGeNoaU']",
  "event_id=$Oy9aTfjL0LSnbF_6MRq7-5baaEbfxyRTK1kbVGeNoaU,depth=10,body=Historical 38 (batch=0),prevs=['$V4qFDnqO1LrboSWwCoQpQ4dXLyrc74qZbbsaHxqAj4Q']",
  "event_id=$V4qFDnqO1LrboSWwCoQpQ4dXLyrc74qZbbsaHxqAj4Q,depth=10,body=Historical 37 (batch=0),prevs=['$vWdLNDGwj_mBJ6JZ2s01OhsxRuPNSSJAM_bMa6J9Q2c']",
  "event_id=$vWdLNDGwj_mBJ6JZ2s01OhsxRuPNSSJAM_bMa6J9Q2c,depth=10,body=Historical 36 (batch=0),prevs=['$JZt2EdPtKJX6f2MMbj_gSEseVAMa-H5r_J_yvfhHs5k']",
  "event_id=$JZt2EdPtKJX6f2MMbj_gSEseVAMa-H5r_J_yvfhHs5k,depth=10,body=Historical 35 (batch=0),prevs=['$NPzUfUgNfvkezhUeLmcp2utVA_XnW8YzDqbZlznsEN0']",
  "event_id=$NPzUfUgNfvkezhUeLmcp2utVA_XnW8YzDqbZlznsEN0,depth=10,body=Historical 34 (batch=0),prevs=['$NNUjzVtvOSFDYRID_PsMJrUC8gx5p1mPvIoMB7ibDn0']",
  "event_id=$NNUjzVtvOSFDYRID_PsMJrUC8gx5p1mPvIoMB7ibDn0,depth=10,body=Historical 33 (batch=0),prevs=['$dONbCTAYR0kOMVSmxOnM5aQ4bgx9PbKza98_e2Lxxw4']",
  "event_id=$dONbCTAYR0kOMVSmxOnM5aQ4bgx9PbKza98_e2Lxxw4,depth=10,body=Historical 32 (batch=0),prevs=['$dwxZHePgzbtQMO3caex0O9Zdl-gT3fpWRZD5dJ43JmE']",
  "event_id=$dwxZHePgzbtQMO3caex0O9Zdl-gT3fpWRZD5dJ43JmE,depth=10,body=Historical 31 (batch=0),prevs=['$5JOpa9222Y0__S8yfaZBT7ESuRaPeeRz80jleMoa5hE']",
  "event_id=$5JOpa9222Y0__S8yfaZBT7ESuRaPeeRz80jleMoa5hE,depth=10,body=Historical 30 (batch=0),prevs=['$7yIEFZZFs91wjKScsjbG854DUOqomPnV4iGG-EDWK6w']",
  "event_id=$7yIEFZZFs91wjKScsjbG854DUOqomPnV4iGG-EDWK6w,depth=10,body=Historical 29 (batch=0),prevs=['$9pzIrDRB1cuweDiHaPGB6AtTtGeGEOmqyoP59UAa0pI']",
  "event_id=$9pzIrDRB1cuweDiHaPGB6AtTtGeGEOmqyoP59UAa0pI,depth=10,body=Historical 28 (batch=0),prevs=['$EBu0Y6-OdqNUumOlHK__K2eXsN8mAYV21eCRKwGmkxU']",
  "event_id=$EBu0Y6-OdqNUumOlHK__K2eXsN8mAYV21eCRKwGmkxU,depth=10,body=Historical 27 (batch=0),prevs=['$95FzYeNZk31wyfaCojognGOAkzLhHLrv4_j3eoJawwU']",
  "event_id=$95FzYeNZk31wyfaCojognGOAkzLhHLrv4_j3eoJawwU,depth=10,body=Historical 26 (batch=0),prevs=['$QDGDnSNRXjNZG2lia2gjeD1aEfgfZ0gxI1BzIgjyZq8']",
  "event_id=$QDGDnSNRXjNZG2lia2gjeD1aEfgfZ0gxI1BzIgjyZq8,depth=10,body=Historical 25 (batch=0),prevs=['$tf1GB8ydPyNTNAaGwcTUXaTOSCmNohK6e6MmOnFwrJA']",
  "event_id=$tf1GB8ydPyNTNAaGwcTUXaTOSCmNohK6e6MmOnFwrJA,depth=10,body=Historical 24 (batch=0),prevs=['$n40ks3dofH6DioQlfe84n3exnYrboy8GHHYJ_qBFJMg']",
  "event_id=$n40ks3dofH6DioQlfe84n3exnYrboy8GHHYJ_qBFJMg,depth=10,body=Historical 23 (batch=0),prevs=['$xl8xG3MJiiNP21WNFmDLxOR8Rhy_FLws0snsmDUoAYQ']",
  "event_id=$xl8xG3MJiiNP21WNFmDLxOR8Rhy_FLws0snsmDUoAYQ,depth=10,body=Historical 22 (batch=0),prevs=['$6MxFONk8t5shoQpjjZyxd0ypmfj76LPs9hWKkPAxMcI']",
  "event_id=$6MxFONk8t5shoQpjjZyxd0ypmfj76LPs9hWKkPAxMcI,depth=10,body=Historical 21 (batch=0),prevs=['$XAAn4gMQe4ShIZKvZntEUBRljDM4IxHDVeNOXp3K2Bk']",
  "event_id=$XAAn4gMQe4ShIZKvZntEUBRljDM4IxHDVeNOXp3K2Bk,depth=10,body=Historical 20 (batch=0),prevs=['$Gj3RlKLUMb6hI_JyXdfwuoneWDs1b63qF7WdYYiNDG0']",
  "event_id=$Gj3RlKLUMb6hI_JyXdfwuoneWDs1b63qF7WdYYiNDG0,depth=10,body=Historical 19 (batch=0),prevs=['$yiRe3l3_APWuZt1wfFBxXQp2orQJZJvwv3yk4QNiPxo']",
  "event_id=$yiRe3l3_APWuZt1wfFBxXQp2orQJZJvwv3yk4QNiPxo,depth=10,body=Historical 18 (batch=0),prevs=['$v04Ud2zPqFe5M3jPbiLrqQ6r_QXgFlmRTMMLyVvAsN8']",
  "event_id=$v04Ud2zPqFe5M3jPbiLrqQ6r_QXgFlmRTMMLyVvAsN8,depth=10,body=Historical 17 (batch=0),prevs=['$tO5NiLH2mPBIMRVmrTIza6CUv7v6R0e_tgj0ZKEtpG0']",
  "event_id=$tO5NiLH2mPBIMRVmrTIza6CUv7v6R0e_tgj0ZKEtpG0,depth=10,body=Historical 16 (batch=0),prevs=['$fyQ-akREpz3vpQNqTZ47yxAs_APAw2L_bQ1iAudsPWk']",
  "event_id=$fyQ-akREpz3vpQNqTZ47yxAs_APAw2L_bQ1iAudsPWk,depth=10,body=Historical 15 (batch=0),prevs=['$qddW2HRZA0BudaIWuun6Odt6wDbz7ETRJmSY8wtjMnY']",
  "event_id=$qddW2HRZA0BudaIWuun6Odt6wDbz7ETRJmSY8wtjMnY,depth=10,body=Historical 14 (batch=0),prevs=['$fxl98r0B-sa2T8LDR2q6Wi01Zw6xCPZB5FcMf5x_vxI']",
  "event_id=$fxl98r0B-sa2T8LDR2q6Wi01Zw6xCPZB5FcMf5x_vxI,depth=10,body=Historical 13 (batch=0),prevs=['$1PML_QTo1MK_EuUz3OYyc2vDjfGKKYt-0sUSN9jTeHs']",
  "event_id=$1PML_QTo1MK_EuUz3OYyc2vDjfGKKYt-0sUSN9jTeHs,depth=10,body=Historical 12 (batch=0),prevs=['$YTz-q29BhUU_Ox7_CR7gao1v7mmMqLwbz51WWI0CjHs']",
  "event_id=$YTz-q29BhUU_Ox7_CR7gao1v7mmMqLwbz51WWI0CjHs,depth=10,body=Historical 11 (batch=0),prevs=['$Y3HUk4SiCWUrV5V_ZUcwC1IkVZEPM3V8oGWrWKRcv3I']",
  "event_id=$Y3HUk4SiCWUrV5V_ZUcwC1IkVZEPM3V8oGWrWKRcv3I,depth=10,body=Historical 10 (batch=0),prevs=['$uV5daep6tIdbImy2XEIxdQIuGYc547ulzxMplDyBWfY']",
  "event_id=$uV5daep6tIdbImy2XEIxdQIuGYc547ulzxMplDyBWfY,depth=10,body=Historical 9 (batch=0),prevs=['$bVKZ6uRROzC7aNcZc9cUsfhHl5dU_-Vm6Qz5V9X8GsI']",
  "event_id=$bVKZ6uRROzC7aNcZc9cUsfhHl5dU_-Vm6Qz5V9X8GsI,depth=10,body=Historical 8 (batch=0),prevs=['$6zjql7LGgIa3gFpf9owZsKWeFU4FoMUKDtVPpMo7xsM']",
  "event_id=$6zjql7LGgIa3gFpf9owZsKWeFU4FoMUKDtVPpMo7xsM,depth=10,body=Historical 7 (batch=0),prevs=['$w5t7UuOHrrsfZRebkX4adeEeJpPPGv9y6RyhKpxToMc']",
  "event_id=$w5t7UuOHrrsfZRebkX4adeEeJpPPGv9y6RyhKpxToMc,depth=10,body=Historical 6 (batch=0),prevs=['$649goNxH4B0DMta75_xs_TTib6C268A2JiUHvpUMu8g']",
  "event_id=$649goNxH4B0DMta75_xs_TTib6C268A2JiUHvpUMu8g,depth=10,body=Historical 5 (batch=0),prevs=['$mtUwpP0KSNwsn73yxBfQ7imKUe955v_SvI427PC5y2I']",
  "event_id=$9JuhSj0h0AbHvky0T3tSRfq_lxg1k2LTHY-J-MW6FfA,depth=9,body=Message 1 (eventIDsBefore),prevs=['$FcPmU5Fjg57eO_2J4VOK9jOcqRclEED5B9i1FsHNjaE']"
]
```
-rw-r--r--synapse/handlers/federation.py158
-rw-r--r--synapse/handlers/federation_event.py86
-rw-r--r--synapse/storage/databases/main/event_federation.py121
3 files changed, 321 insertions, 44 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py

index c478e0bc5c..e28c74daf0 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py
@@ -16,6 +16,7 @@ """Contains handlers for federation events.""" import logging +from queue import Empty, PriorityQueue from http import HTTPStatus from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Tuple, Union @@ -1041,6 +1042,135 @@ class FederationHandler: else: return [] + async def get_backfill_events( + self, room_id: str, event_id_list: list, limit: int + ) -> List[EventBase]: + event_id_results = set() + + # In a PriorityQueue, the lowest valued entries are retrieved first. + # We're using depth as the priority in the queue and tie-break based on + # stream_ordering. Depth is lowest at the oldest-in-time message and + # highest and newest-in-time message. We add events to the queue with a + # negative depth so that we process the newest-in-time messages first + # going backwards in time. stream_ordering follows the same pattern. + queue = PriorityQueue() + + seed_events = await self.store.get_events_as_list(event_id_list) + for seed_event in seed_events: + # Make sure the seed event actually pertains to this room. We also + # need to make sure the depth is available since our whole DAG + # navigation here depends on depth. + if seed_event.room_id == room_id and seed_event.depth: + queue.put( + ( + -seed_event.depth, + -seed_event.internal_metadata.stream_ordering, + seed_event.event_id, + seed_event.type, + ) + ) + + while not queue.empty() and len(event_id_results) < limit: + try: + _, _, event_id, event_type = queue.get_nowait() + except Empty: + break + + if event_id in event_id_results: + continue + + event_id_results.add(event_id) + + if self.hs.config.experimental.msc2716_enabled: + # Try and find any potential historical batches of message history. + # + # First we look for an insertion event connected to the current + # event (by prev_event). If we find any, we'll add them to the queue + # and navigate up the DAG like normal in the next iteration of the + # loop. + connected_insertion_event_backfill_results = ( + await self.store.get_connected_insertion_event_backfill_results( + event_id, limit - len(event_id_results) + ) + ) + logger.debug( + "_get_backfill_events: connected_insertion_event_backfill_results=%s", + connected_insertion_event_backfill_results, + ) + for ( + connected_insertion_event_backfill_item + ) in connected_insertion_event_backfill_results: + if ( + connected_insertion_event_backfill_item.event_id + not in event_id_results + ): + queue.put( + ( + -connected_insertion_event_backfill_item.depth, + -connected_insertion_event_backfill_item.stream_ordering, + connected_insertion_event_backfill_item.event_id, + connected_insertion_event_backfill_item.type, + ) + ) + + # Second, we need to go and try to find any batch events connected + # to a given insertion event (by batch_id). If we find any, we'll + # add them to the queue and navigate up the DAG like normal in the + # next iteration of the loop. + if event_type == EventTypes.MSC2716_INSERTION: + connected_batch_event_backfill_results = ( + await self.store.get_connected_batch_event_backfill_results( + event_id, limit - len(event_id_results) + ) + ) + logger.debug( + "_get_backfill_events: connected_batch_event_backfill_results %s", + connected_batch_event_backfill_results, + ) + for ( + connected_batch_event_backfill_item + ) in connected_batch_event_backfill_results: + if ( + connected_batch_event_backfill_item.event_id + not in event_id_results + ): + queue.put( + ( + -connected_batch_event_backfill_item.depth, + -connected_batch_event_backfill_item.stream_ordering, + connected_batch_event_backfill_item.event_id, + connected_batch_event_backfill_item.type, + ) + ) + + # Now we just look up the DAG by prev_events as normal + connected_prev_event_backfill_results = ( + await self.store.get_connected_prev_event_backfill_results( + event_id, limit - len(event_id_results) + ) + ) + logger.debug( + "_get_backfill_events: prev_event_ids %s", + connected_prev_event_backfill_results, + ) + for ( + connected_prev_event_backfill_item + ) in connected_prev_event_backfill_results: + if connected_prev_event_backfill_item.event_id not in event_id_results: + queue.put( + ( + -connected_prev_event_backfill_item.depth, + -connected_prev_event_backfill_item.stream_ordering, + connected_prev_event_backfill_item.event_id, + connected_prev_event_backfill_item.type, + ) + ) + + events = await self.store.get_events_as_list(event_id_results) + return sorted( + events, key=lambda e: (-e.depth, -e.internal_metadata.stream_ordering) + ) + @log_function async def on_backfill_request( self, origin: str, room_id: str, pdu_list: List[str], limit: int @@ -1053,6 +1183,34 @@ class FederationHandler: limit = min(limit, 100) events = await self.store.get_backfill_events(room_id, pdu_list, limit) + logger.info( + "old implementation backfill events=%s", + [ + "event_id=%s,depth=%d,body=%s,prevs=%s\n" + % ( + event.event_id, + event.depth, + event.content.get("body", event.type), + event.prev_event_ids(), + ) + for event in events + ], + ) + + events = await self.get_backfill_events(room_id, pdu_list, limit) + logger.info( + "new implementation backfill events=%s", + [ + "event_id=%s,depth=%d,body=%s,prevs=%s\n" + % ( + event.event_id, + event.depth, + event.content.get("body", event.type), + event.prev_event_ids(), + ) + for event in events + ], + ) events = await filter_events_for_server(self.storage, origin, events) diff --git a/synapse/handlers/federation_event.py b/synapse/handlers/federation_event.py
index ab2ed53bce..c9060a594f 100644 --- a/synapse/handlers/federation_event.py +++ b/synapse/handlers/federation_event.py
@@ -702,38 +702,38 @@ class FederationEventHandler: event.event_id ) - # Maybe we can get lucky and save ourselves a lookup - # by checking the events in the backfill first - insertion_event = event_map[ - insertion_event_id - ] or await self._store.get_event( - insertion_event_id, allow_none=True - ) - - if insertion_event: - # Connect the insertion events' `prev_event` successors - # via fake edges pointing to the insertion event itself - # so the insertion event sorts topologically - # behind-in-time the successor. Nestled perfectly - # between the prev_event and the successor. - for insertion_prev_event_id in insertion_event.prev_event_ids(): - successor_event_ids = successor_event_id_map[ - insertion_prev_event_id - ] - logger.info( - "insertion_event_id=%s successor_event_ids=%s", - insertion_event_id, - successor_event_ids, - ) - if successor_event_ids: - for successor_event_id in successor_event_ids: - # Don't add itself back as a successor - if successor_event_id != insertion_event_id: - # Fake edge to point the successor back - # at the insertion event - event_id_graph.setdefault( - successor_event_id, [] - ).append(insertion_event_id) + # # Maybe we can get lucky and save ourselves a lookup + # # by checking the events in the backfill first + # insertion_event = event_map[ + # insertion_event_id + # ] or await self._store.get_event( + # insertion_event_id, allow_none=True + # ) + + # if insertion_event: + # # Connect the insertion events' `prev_event` successors + # # via fake edges pointing to the insertion event itself + # # so the insertion event sorts topologically + # # behind-in-time the successor. Nestled perfectly + # # between the prev_event and the successor. + # for insertion_prev_event_id in insertion_event.prev_event_ids(): + # successor_event_ids = successor_event_id_map[ + # insertion_prev_event_id + # ] + # logger.info( + # "insertion_event_id=%s successor_event_ids=%s", + # insertion_event_id, + # successor_event_ids, + # ) + # if successor_event_ids: + # for successor_event_id in successor_event_ids: + # # Don't add itself back as a successor + # if successor_event_id != insertion_event_id: + # # Fake edge to point the successor back + # # at the insertion event + # event_id_graph.setdefault( + # successor_event_id, [] + # ).append(insertion_event_id) # TODO: We also need to add fake edges to connect the oldest-in-time messages # in the batch to the event we branched off of, see https://github.com/matrix-org/synapse/pull/11114#discussion_r739300985 @@ -773,17 +773,17 @@ class FederationEventHandler: # We want to sort these by depth so we process them and # tell clients about them in order. - # sorted_events = sorted(events, key=lambda x: x.depth) - - # We want to sort topologically so we process them and tell clients - # about them in order. - sorted_events = [] - event_ids = [event.event_id for event in events] - event_map = {event.event_id: event for event in events} - event_id_graph = await self.generateEventIdGraphFromEvents(events) - for event_id in sorted_topologically(event_ids, event_id_graph): - sorted_events.append(event_map[event_id]) - sorted_events = reversed(sorted_events) + sorted_events = sorted(events, key=lambda x: x.depth) + + # # We want to sort topologically so we process them and tell clients + # # about them in order. + # sorted_events = [] + # event_ids = [event.event_id for event in events] + # event_map = {event.event_id: event for event in events} + # event_id_graph = await self.generateEventIdGraphFromEvents(events) + # for event_id in sorted_topologically(event_ids, event_id_graph): + # sorted_events.append(event_map[event_id]) + # sorted_events = reversed(sorted_events) logger.info( "backfill sorted_events=%s", diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index 4a4d35f77c..a569e8146a 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py
@@ -14,7 +14,7 @@ import itertools import logging from queue import Empty, PriorityQueue -from typing import Collection, Dict, Iterable, List, Optional, Set, Tuple +from typing import Collection, Dict, Iterable, List, Optional, Set, Tuple, NamedTuple from prometheus_client import Counter, Gauge @@ -53,6 +53,14 @@ pdus_pruned_from_federation_queue = Counter( logger = logging.getLogger(__name__) +# All the info we need while iterating the DAG while backfilling +class BackfillQueueNavigationItem(NamedTuple): + depth: int + stream_ordering: int + event_id: str + type: str + + class _NoChainCoverIndex(Exception): def __init__(self, room_id: str): super().__init__("Unexpectedly no chain cover for events in %s" % (room_id,)) @@ -987,6 +995,117 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas "get_forward_extremeties_for_room", get_forward_extremeties_for_room_txn ) + async def get_connected_insertion_event_backfill_results( + self, event_id: str, limit: int + ) -> List[BackfillQueueNavigationItem]: + def _get_connected_insertion_event_backfill_results_txn(txn): + # Look for the "insertion" events connected to the given event_id + connected_insertion_event_query = """ + SELECT e.depth, e.stream_ordering, i.event_id, e.type FROM insertion_event_edges AS i + /* Get the depth of the insertion event from the events table */ + INNER JOIN events AS e USING (event_id) + /* Find an insertion event which points via prev_events to the given event_id */ + WHERE i.insertion_prev_event_id = ? + LIMIT ? + """ + + txn.execute( + connected_insertion_event_query, + (event_id, limit), + ) + connected_insertion_event_id_results = txn.fetchall() + return [ + BackfillQueueNavigationItem( + depth=row[0], + stream_ordering=row[1], + event_id=row[2], + type=row[3], + ) + for row in connected_insertion_event_id_results + ] + + return await self.db_pool.runInteraction( + "get_connected_insertion_event_backfill_results", + _get_connected_insertion_event_backfill_results_txn, + ) + + async def get_connected_batch_event_backfill_results( + self, insertion_event_id: str, limit: int + ) -> List[BackfillQueueNavigationItem]: + def _get_connected_batch_event_backfill_results_txn(txn): + # Find any batch connections of a given insertion event + batch_connection_query = """ + SELECT e.depth, e.stream_ordering, c.event_id, e.type FROM insertion_events AS i + /* Find the batch that connects to the given insertion event */ + INNER JOIN batch_events AS c + ON i.next_batch_id = c.batch_id + /* Get the depth of the batch start event from the events table */ + INNER JOIN events AS e USING (event_id) + /* Find an insertion event which matches the given event_id */ + WHERE i.event_id = ? + LIMIT ? + """ + + # Find any batch connections for the given insertion event + txn.execute( + batch_connection_query, + (insertion_event_id, limit), + ) + batch_start_event_id_results = txn.fetchall() + return [ + BackfillQueueNavigationItem( + depth=row[0], + stream_ordering=row[1], + event_id=row[2], + type=row[3], + ) + for row in batch_start_event_id_results + ] + + return await self.db_pool.runInteraction( + "get_connected_batch_event_backfill_results", + _get_connected_batch_event_backfill_results_txn, + ) + + async def get_connected_prev_event_backfill_results( + self, event_id: str, limit: int + ) -> List[BackfillQueueNavigationItem]: + def _get_connected_prev_event_backfill_results_txn(txn): + # Look for the prev_event_id connected to the given event_id + connected_prev_event_query = """ + SELECT depth, stream_ordering, prev_event_id, events.type FROM event_edges + /* Get the depth and stream_ordering of the prev_event_id from the events table */ + INNER JOIN events + ON prev_event_id = events.event_id + /* Look for an edge which matches the given event_id */ + WHERE event_edges.event_id = ? + AND event_edges.is_state = ? + /* Because we can have many events at the same depth, + * we want to also tie-break and sort on stream_ordering */ + ORDER BY depth DESC, stream_ordering DESC + LIMIT ? + """ + + txn.execute( + connected_prev_event_query, + (event_id, False, limit), + ) + prev_event_id_results = txn.fetchall() + return [ + BackfillQueueNavigationItem( + depth=row[0], + stream_ordering=row[1], + event_id=row[2], + type=row[3], + ) + for row in prev_event_id_results + ] + + return await self.db_pool.runInteraction( + "get_connected_prev_event_backfill_results", + _get_connected_prev_event_backfill_results_txn, + ) + async def get_backfill_events(self, room_id: str, event_list: list, limit: int): """Get a list of Events for a given topic that occurred before (and including) the events in event_list. Return a list of max size `limit`