public async Task SiloInstanceTable_Op_CleanDeadSiloInstance()
        {
            // Register a silo entry
            await manager.TryCreateTableVersionEntryAsync();

            this.generation = 0;
            RegisterSiloInstance();
            // and mark it as dead
            await manager.UnregisterSiloInstance(myEntry);

            // Create new active entries
            for (int i = 1; i < 5; i++)
            {
                this.generation  = i;
                this.siloAddress = SiloAddressUtils.NewLocalSiloAddress(generation);
                var instance = RegisterSiloInstance();
                await manager.ActivateSiloInstance(instance);
            }

            await Task.Delay(TimeSpan.FromSeconds(3));

            await manager.CleanupDefunctSiloEntries(DateTime.Now - TimeSpan.FromSeconds(1));

            var entries = await manager.FindAllSiloEntries();

            Assert.Equal(5, entries.Count);
            Assert.All(entries, e => Assert.NotEqual(SiloInstanceTableTestConstants.INSTANCE_STATUS_DEAD, e.Item1.Status));
        }
Example #2
0
        public async Task SiloInstanceTable_Op_CreateSiloEntryConditionally()
        {
            bool didInsert = await manager.TryCreateTableVersionEntryAsync()
                .WithTimeout(AzureTableDefaultPolicies.TableOperationTimeout);

            Assert.IsTrue(didInsert, "Did insert");
        }
Example #3
0
        public async Task InitializeMembershipTable(bool tryInitTableVersion)
        {
            AzureTableDefaultPolicies.MaxBusyRetries = options.MaxStorageBusyRetries;
            LogFormatter.SetExceptionDecoder(typeof(StorageException), AzureStorageUtils.PrintStorageException);

            tableManager = await OrleansSiloInstanceManager.GetManager(
                this.clusterId, options.ConnectionString, this.loggerFactory);

            // even if I am not the one who created the table,
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if (tryInitTableVersion)
            {
                // ignore return value, since we don't care if I inserted it or not, as long as it is in there.
                bool created = await tableManager.TryCreateTableVersionEntryAsync();

                if (created)
                {
                    logger.Info("Created new table version row.");
                }
            }
        }
Example #4
0
        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            logger = traceLogger;
            AzureTableDefaultPolicies.MaxBusyRetries = config.MaxStorageBusyRetries;
            TraceLogger.SetExceptionDecoder(typeof(StorageException), AzureStorageUtils.PrintStorageException);

            tableManager = await OrleansSiloInstanceManager.GetManager(
                config.DeploymentId, config.DataConnectionString);

            // even if I am not the one who created the table,
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if (tryInitTableVersion)
            {
                // ignore return value, since we don't care if I inserted it or not, as long as it is in there.
                bool created = await tableManager.TryCreateTableVersionEntryAsync();

                if (created)
                {
                    logger.Info("Created new table version row.");
                }
            }
        }